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>
current window hash: <span id="current"></span><br><br>
<ul id="slider">
<li id="slide1"><img src="http://placekitten.com/300/200" alt="" /></li>
<li id="slide2"><img src="http://placehold.it/300x200" alt="" /></li>
<li id="slide3"><img src="http://placebear.com/300/200" alt="" /></li>
<li id="slide4"><img src="http://lorempixel.com/300/200" alt="" /></li>
<li id="slide5"><img src="http://placedog.com/300/200" alt="" /></li>
</ul>
<br>
Slide:
<a class="link" href="#slide1">1</a>
<a class="link" href="#slide2">2</a>
<a class="link" href="#slide3">3</a>
<a class="link" href="#slide4">4</a>
<a class="link" href="#slide5">5</a>
<!-- Add stylesheets here -->
<link rel="stylesheet" href="http://proloser.github.com/AnythingSlider/css/theme-metallic.css">
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: 200px;
list-style: none;
}
JavaScript
$('#slider').anythingSlider({
// disable the default hash tags
hashTags : false,
// Callback when the plugin finished initializing
onInitialized: function(e, slider) {
if (window.location.hash) {
slider.gotoPage(window.location.hash);
}
},
// update the hash AFTER the slide is in view (so we can animate)
onSlideComplete : function(slider){
window.location.hash = '#' + slider.$currentPage[0].id;
// this line is for this demo only
$('#current').html(window.location.hash);
}
});
// allow external links to control the slider
$('a.link').click(function(){
// pass the ID directly to the slider (e.g. '#slide2')
$('#slider').anythingSlider( $(this).attr('href') );
return false;
});