Quick question.
Trying to make a hoverable scroll control for my site. I want the page to scroll when you hover over the button rather than when you click it. I have it mostly working but it seems a little glitchy mainly because the hover event continually triggers the animate method. I was wondering if there was a more clean way to trigger it. Below is the code I have so far.
$("#goUp").hover(function () {
var curpos= $('body').scrollTop();
$("body").animate({scrollTop: curpos- 200}, 800);
}, function () {
// I want to stop the animation here when they mouse out
});
$("#goDown").hover(function () {
var curpos= $('body').scrollTop();
$("body").animate({scrollTop: curpos+ 200}, 800);
}, function () {
// I want to stop the animation here when they mouse out
});
Thanks for any help
Use the following to stop animation.