michanoku-carousel
v1.2.0
Published
A simple carousel script to use on any website. Created as practice for The Odin Project.
Downloads
7
Readme
michanoku-carousel
A simple carousel script to use on any website. Created as part of The Odin Project.
Installation
npm install michanoku-carouselUsage
Add the HTML
<div class="michanoku-carousel" data-width="780" data-height="450" data-delay="5000">
<div class="michanoku-slides">
<img alt="" src="./00.jpg">
<img alt="" src="./01.jpg">
<img alt="" src="./02.jpg">
</div>
</div>- Create an outer container with the class michanoku-carousel and data attributes:
- data-width → carousel width
- data-height → carousel height
- data-delay (optional) → autoplay delay in milliseconds
- Inside, create an inner container with the class michanoku-slides and place your tags inside.
In your JS file:
import { carousels } from "michanoku-carousel";
carousels.initCarousels();- Import carousels and call initCarousels() after your carousel HTML is loaded.
Example
<body>
<div class="michanoku-carousel" data-width="600" data-height="400" data-delay="3000">
<div class="michanoku-slides">
<img src="slide1.jpg" alt="First slide">
<img src="slide2.jpg" alt="Second slide">
<img src="slide3.jpg" alt="Third slide">
</div>
</div>
<script type="module">
import { carousels } from "michanoku-carousel";
carousels.initCarousels();
</script>
</body>License
MIT © Michael Werker
Copyright (c) 2025 Michael Werker
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
