Created
September 14, 2012 02:43
-
-
Save cmcculloh/3719497 to your computer and use it in GitHub Desktop.
refactored slider code
This file contains 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
//SPOTLIGHT SLIDER LAYOUT 3 | |
jQuery("#slider3 > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", <?php echo $con_spotlight_duration; ?>000, false); | |
var rotateHoverHandler = { | |
hoveredOver: false, | |
stopSlider: false, | |
isRotating: true, | |
hoverOver: function(){ | |
jQuery("#slider3 > ul").tabs("rotate", null, false); | |
rotateHoverHandler.hoveredOver = true; | |
}, | |
hoverOut: function(){ | |
rotateHoverHandler.hoveredOver = false; | |
rotateHoverHandler.tryToRotate(); | |
}, | |
tryToRotate: function(){ | |
if(!rotateHoverHandler.isRotating && !rotateHoverHandler.hoveredOver){ | |
rotateHoverHandler.isRotating = true; | |
jQuery("#slider3 > ul").tabs("rotate", <?php echo $con_spotlight_duration; ?>000, false); | |
}else{ | |
rotateHoverHandler.isRotating = false; | |
jQuery("#slider3 > ul").tabs("rotate", null, false);//clear the rotate again, just in case | |
} | |
} | |
} | |
jQuery("#slider3-wrapper").hover(rotateHoverHandler.hoverOver, rotateHoverHandler.hoverOut); | |
/*start the timer over if they click, because it means they are interacting with something other | |
than the video. So, once the video is over, they might click on the next tab in the slider and then | |
hover off, meaning they want the slider to rotate.*/ | |
document.body.onmousedown = function(){ | |
rotateHoverHandler.tryToRotate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment