What i’m trying to do is if the mouse is over the ‘next’ button it scrolls to the right at a slow speed and if the mouse isn’t over the ‘next’ button it stops scrolling?
here is my attempt http://jsfiddle.net/mdanz/nCCRy/14/
$(function() {
$('#next-button').hover(function() {
$('#display-container').animate({
'scrollLeft': '+=120px'
}, '500');
});
});
Check out jQuery’s
.stop()method:Here’s the fiddle: http://jsfiddle.net/nCCRy/17/