javascript - Dreamweaver CS6 - How do I stop slider on mouseover? -
below jquery code.. i'm wondering how , in code have enter function, when go on slider pause sliding.. , when move mouse out of slider, continues slide photos..
$(document).ready(function() { $('.photo').hover(function() { $(this) .find('.caption') .stop() .animate({ bottom: '0' }, { duration: 2000, easing: 'easeoutquart' }); }, function() { $(this) .find('.caption') .stop() .animate({ bottom: '-100px' }, { duration: 2000, easing: 'easeoutquart' }); var interval = setinterval(slideswitch, 2000); }); });
you can use jquery's hover() function shortcut:
$(function() { var interval = setinterval( slideswitch, 10000 ); $('#slideshow').hover(function() { clearinterval(interval); }, function() { interval = setinterval( slideswitch, 10000 ); }); });
here link working example.
Comments
Post a Comment