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>
<!-- Add stylesheets here -->
<link rel="stylesheet" href="http://css-tricks.github.com/AnythingSlider/css/theme-metallic.css">

<ul id="slider">
    <li><img src="http://placekitten.com/320/240" alt="" /></li>
    <li>
        <video width="320" height="240" controls="controls">
            <source src="http://css-tricks.github.com/AnythingSlider/demos/video/movie.ogg" type="video/ogg">
            <source src="http://css-tricks.github.com/AnythingSlider/demos/video/movie.mp4" type="video/mp4">
            <source src="http://css-tricks.github.com/AnythingSlider/demos/video/movie.webm" type="video/webm">
            Your browser does not support the video tag.
        </video>
    </li>
    <li><img src="http://placehold.it/320x240" alt="" /></li>         
    <li><img src="http://ipsumimage.appspot.com/320x240.png" alt="" /></li>              
    <li><img src="http://lorempixel.com/300/200" alt="" /></li>              
</ul>

CSS

/*** Set Slider dimensions here! Version 1.7+ ***/
ul#slider {
    width: 320px;
    height: 240px;
    list-style: none;
}

JavaScript

$('#slider').anythingSlider({
    // pause video when out of view
    onSlideInit: function(e, slider) {
        var vid = slider.$lastPage.find('video');
        if (vid.length && typeof(vid[0].pause) !== 'undefined') {
            vid[0].pause();
        }
    },
    // continue playing video if already started
    onSlideComplete: function(slider) {
        var vid = slider.$currentPage.find('video');
        if (vid.length && typeof(vid[0].pause) !== 'undefined' && vid[0].paused && vid[0].currentTime > 0 && !vid[0].ended) {
            vid[0].play();
        }
    },
    // pause slideshow if video is playing
    isVideoPlaying : function(slider){
        var vid = slider.$currentPage.find('video');
        return (vid.length && typeof(vid[0].pause) !== 'undefined' && !vid[0].paused && !vid[0].ended) ? true : false;
    }
});