carousel24
v1.0.1
Published
It is a carousel for vanilla javascript
Downloads
5
Maintainers
Readme
carousel-plugin
Installation
npm i carousel24
After installation is complete then link your
npm
package to your document.Next place
<carousel-component></carousel-component>
[ it is a custom web component] inside your HTML document with id attributecarouselHost
.
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./node_modules/carousel24/dist/index.js" defer></script>
<script src="./index.js" type="module" defer></script>
<title>Document</title>
</head>
<body>
<carousel-component id="carouselHost"></carousel-component>
</body>
</html>
- Now the package provide two functions --
carouselSetup
[ for initializing ] andinitiateAutoSlide
.
Example:
const { carouselSetup, initiateAutoSlide } = Carousel;
const options = [
{ imageUrl: '../imgfile', text: '...'},
{ imageUrl: '../imgfile', text: '...'},
{ imageUrl: '../imgfile', text: '...'}
]
carouselSetup(options);
initiateAutoSlide(); // for adding auto slide feature
- If no options are provided then it will run on default slides and text. Maximum five images can be provided. Providing text for each screen is optional.