Automatic Image Rotator / Carousel Plugin with jQuery
File Size: | 7.6 KB |
---|---|
Views Total: | 1954 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Yet another jQuery image carousel plugin which automatically rotate through any number of images at a given interval.
How to use it:
1. Insert a list of images together with next/prev navigation buttons into the document.
<div class="caroursel rotator-demo"> <ul class="rotator-list"> <li class="rotator-item"><img src="image/1.jpg"></li> <li class="rotator-item"><img src="image/2.jpg"></li> <li class="rotator-item"><img src="image/3.jpg"></li> </ul> <div class="rotator-btn rotator-prev-btn"></div> <div class="rotator-btn rotator-next-btn"></div> </div>
2. Add jQuery library and the jQuery carousel.js plugin to the web page.
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> <script src="js/jquery.carousel.js"></script>
3. Initialize the carousel and we're ready to go.
Caroursel.init($('.caroursel'))
4. Style the image carousel with you own CSS styles.
.rotator-main { position: relative; width: 900px; height: 400px } .rotator-main a, .rotator-main img { display: block; } .rotator-main .rotator-list { width: 900px; height: 400px } .rotator-main .rotator-list .rotator-item { position: absolute; left: 0px; top: 0px } .rotator-main .rotator-btn { position: absolute; height: 100%; width: 100px; top: 0px; z-index: 10; opacity: 0; } .rotator-main .rotator-prev-btn { left: 0px; background: url("../image/btn_l.png") no-repeat center center; background-color: red } .rotator-main .rotator-next-btn { right: 0px; background: url("../image/btn_r.png") no-repeat center center; background-color: red }
5. You can pass the options to the carousel plugin using data-setting
attribute on the top container.
<div class="caroursel rotator-main" data-setting = '{ "width":1000, "height":270, "rotatorWidth":640, "rotatorHeight":270, "scale":0.8, "algin":"middle" }'>
This awesome jQuery plugin is developed by JANGFREEMAN. For more Advanced Usages, please check the demo page or visit the official website.