我在我的网站上有一个简单的欢迎页面,它显示图像及其标题和按钮以注册。禁用向下滚动,同时检测滚动
工作小提琴:JSFiddle
问题:我希望能够禁用页面的滚动,在检测任何上下滚动的事件。
这是因为我希望能够对下滚动事件执行一些动画,而不是实际滚动的页面。
尝试:
$(document).ready(function() {
var CurrentScroll = 0;
$(window).scroll(function(event){
var NextScroll = $(this).scrollTop();
if (NextScroll > CurrentScroll){
//write the codes related to down-ward scrolling here
/// Animations Codes Here
}
else {
//write the codes related to upward-scrolling here
}
CurrentScroll = NextScroll; //Updates current scroll position
});
});
这是我尝试检测向下滚动剧本,但动画是没有看到由于滚动,因此我需要一个解决方法。
我怎样才能实现我想用jquery?
您的代码中有语法错误。为什么你使用'});'3次?它应该是两次 –
什么动画你想scrolldown? –
我希望能够在动画发生时禁用页面的滚动@NiravJoshi –