防止向下滚动
Preventing downward scroll
我想尝试防止向下滚动同时允许向上滚动是否可以使用 css 或 javascript/jQuery?
您可以使用 stopPropogation 和 preventDefault,如此处所示 > jQuery or Javascript - how to disable window scroll without overflow:hidden;
stopPropogation 阻止事件冒泡到父级并 preventDefault 尝试在可能的情况下取消事件。
所以我会将它们绑定到滚动处理程序。
$(window).scroll(function(e){
e.preventDefault();
e.stopPropogation();
});
我想尝试防止向下滚动同时允许向上滚动是否可以使用 css 或 javascript/jQuery?
您可以使用 stopPropogation 和 preventDefault,如此处所示 > jQuery or Javascript - how to disable window scroll without overflow:hidden;
stopPropogation 阻止事件冒泡到父级并 preventDefault 尝试在可能的情况下取消事件。
所以我会将它们绑定到滚动处理程序。
$(window).scroll(function(e){
e.preventDefault();
e.stopPropogation();
});