Last active
December 20, 2015 12:29
-
-
Save tommaitland/6131309 to your computer and use it in GitHub Desktop.
How to use Carousel - http://carousel.io
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.carousel').carousel({ | |
slide: 'img', | |
speed: 5000, | |
transition: 'fade', // 'fade', 'slide' | |
transitionSpeed: 2000, | |
easing: 'ease', // 'ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear' | |
firstSlide: 1, | |
pauseOnHover: true, | |
cssAnimations: true, | |
fallback: true, | |
allowJump: true, // allow the use of pager navigation | |
// callbacks | |
onSlide: function () {}, | |
onNext: function () {}, | |
onPrev: function () {}, | |
onJump: function () {}, | |
onStart: function () {}, | |
onPause: function () {}, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add carousel.css to your <head> or import the LESS file --> | |
<style type="text/css" href="carousel.css" /> | |
<!-- Include Carousel.js after jQuery --> | |
<script src="jquery.js"></script> | |
<script src="carousel.js"></script> | |
<!-- Setup your DOM. Carousel needs a wrapper around your slides. --> | |
<div id="my-demo-carousel"> | |
<img src="slide.jpg" /> | |
<img src="slide.jpg" /> | |
<img src="slide.jpg" /> | |
</div> | |
<div id="my-second-demo-carousel"> | |
<div class="slide-content">Slide 1</div> | |
<div class="slide-content">Slide 2</div> | |
<div class="slide-content">Slide 3</div> | |
</div> | |
<!-- Next & previous navigation --> | |
<a href="#" data-carousel="prev">Previous</a> | |
<a href="#" data-carousel="next">Next</a> | |
<!-- Slide-by-slide navigation --> | |
<a href="#1" data-carousel="jump">1</a> | |
<a href="#2" data-carousel="jump">2</a> | |
<a href="#3" data-carousel="jump">2</a> | |
<!-- Configure carousel --> | |
<script> | |
// load with defaults | |
$('#my-demo-carousel').carousel(); | |
// specify the element to slide | |
$('#my-demo-carousel').carousel({ | |
slide: '.slide-content' | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This sounds awesome to me. I also read about the WinForms UI Carousel recently. Don't know if it is convenient in using. Anyway, its carousel control guide is not quite detailed for me. This JS carousel do make sense to me.