2
快速的问题。Jquery scrollup hover stop
试图为我的网站做一个可移动的滚动控件。当您将鼠标悬停在按钮上时,而不是点击它时,我希望页面滚动。我主要工作,但似乎有点毛刺,主要是因为悬停事件不断触发动画方法。我想知道是否有更简洁的方式来触发它。以下是我到目前为止的代码。
$("#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
});
感谢所有帮助
完美:D这就是我所缺少的。谢谢:)当它让我时,我会在9分钟内将它标记出来 – TheSnooker