AnythingSlider playground
Add, remove, adjust any or all options so you can see how it works.
by Mottie
HTML
<link rel="stylesheet" href="http://css-tricks.github.com/AnythingSlider/css/anythingslider.css">
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.easing.1.2.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/swfobject.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.fx.js"></script>
<script src="http://css-tricks.github.com/AnythingSlider/js/jquery.anythingslider.video.js"></script>
<!-- Add additional stylesheets here -->
<link rel="stylesheet" href="http://css-tricks.github.com/AnythingSlider/css/theme-metallic.css">
<ul class="slider">
<li><img src="http://placekitten.com/300/100" alt="" /></li>
<li><img src="http://placehold.it/300x100" alt="" /></li>
<li><img src="http://placebear.com/300/100" alt="" /></li>
<li><img src="http://lorempixel.com/300/100" alt="" /></li>
<li><img src="http://placedog.com/300/100" alt="" /></li>
</ul>
<br/>
<ul class="slider">
<li><img src="http://placekitten.com/300/100" alt="" /></li>
<li><img src="http://placehold.it/300x100" alt="" /></li>
<li><img src="http://placebear.com/300/100" alt="" /></li>
<li><img src="http://lorempixel.com/300/100" alt="" /></li>
<li><img src="http://placedog.com/300/100" alt="" /></li>
</ul>
<br/>
<ul class="slider">
<li><img src="http://placekitten.com/300/100" alt="" /></li>
<li><img src="http://placehold.it/300x100" alt="" /></li>
<li><img src="http://placebear.com/300/100" alt="" /></li>
<li><img src="http://lorempixel.com/300/100" alt="" /></li>
<li><img src="http://placedog.com/300/100" alt="" /></li>
</ul>
CSS
/*** Set Slider dimensions here! Version 1.7+ ***/
/* added #slider li to make panels the same size in case "resizeContents" is false */
ul.slider, ul.slider li {
width: 300px;
height: 100px;
list-style: none;
}
JavaScript
// Play slideshows sequentially
// ****************************
$('.slider').anythingSlider({
// How long between slideshow transitions in AutoPlay mode (in milliseconds)
// made 1000 for this demo only
delay: 1000,
// if false, the slider will not wrap
infiniteSlides: false,
// If true, the slideshow will start running; replaces "startStopped" option
autoPlay: false,
// If true, starting a slideshow will delay advancing slides;
// if false, the slider will immediately advance to the next slide when slideshow starts
autoPlayDelayed: true,
// If true & the slideshow is active, the slideshow will stop on the last page.
// This also stops the rewind effect when infiniteSlides is false.
stopAtEnd: true,
onInitialized: function(e, slider) {
// start slideshow on first slider
if (slider.runTimes === 1) {
// add a delayed start because the script stops the slideshow on
// initialization because the autoPlay option is false
setTimeout(function(){
// start the slideshow
slider.startStop(true);
}, 10);
}
},
// Callback after slideshow stops
onShowStop: function(e, slider) {
// are we on the last page?
if (slider.targetPage === slider.pages) {
// are we ending the last slider?
if (slider.runTimes < $('.anythingBase').length) {
// ***************************************
// *** If switching tabs, do that here ***
// ***************************************
// add enough of a delay to allow switching tabs
// Note: the onShowStop callback is run when the last slide comes
// into view. So we need to add the delay + time to switch tabs in
// the setTimeout below
setTimeout(function(){
// Find the next...