Created
October 1, 2013 21:26
-
-
Save infinitylabs/6785376 to your computer and use it in GitHub Desktop.
Infinity Slider
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
| //--------------------------------------------------------------------------// | |
| //slider | |
| rotateNext = function(){ | |
| jQuery('.top-image-container .featured').filter(':visible').fadeOut(1000,function(){ | |
| if(jQuery(this).next('div.featured').size()){ | |
| jQuery(this).next().fadeIn(1000); | |
| } | |
| else{ | |
| jQuery('.top-image-container .featured').eq(0).fadeIn(1000); | |
| } | |
| }); | |
| }; | |
| rotatePrev = function(){ | |
| jQuery('.top-image-container .featured').filter(':visible').fadeOut(1000,function(){ | |
| if(jQuery(this).prev('div.featured').size()){ | |
| jQuery(this).prev().fadeIn(1000); | |
| } else{ | |
| jQuery('.top-image-container .featured').eq(jQuery('.top-image-container .featured').size()-1).fadeIn(1000); | |
| } | |
| }); | |
| }; | |
| rotateStart = function(){ //Rotation + Timing Event | |
| play = setInterval(function(){ //Set timer - this will repeat itself every 10 seconds | |
| rotateNext(); | |
| }, 10000); //Timer speed in milliseconds (10 seconds) | |
| }; | |
| nextSlider = function(){ | |
| clearInterval(play); //Stop the rotation | |
| rotateNext(); //Trigger rotation immediately | |
| rotateStart(); // Resume rotation | |
| return false; //Prevent browser jump to link anchor | |
| }; | |
| prevSlider = function(){ | |
| clearInterval(play); //Stop the rotation | |
| rotatePrev(); //Trigger rotation immediately | |
| rotateStart(); // Resume rotation | |
| return false; //Prevent browser jump to link anchor | |
| }; | |
| rotateStart(); //Run function on launch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment