当前第2页 返回上一页
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | <!DOCTYPE html>
<html>
<head>
<meta charset= "utf-8" >
<style>
html,body {
height: 300%
}
div {
position: fixed;
padding-left: 10px;
padding-top: 30px;
height: 10%;
width: 35%;
font-weight: bold;
border: 2px solid red;
}
</style>
</head>
<body>
<div></div>
<script src= "https://code.jquery.com/jquery-1.10.2.js" ></script>
<script>
var position = $(window).scrollTop();
$(window).scroll( function () {
var scroll = $(window).scrollTop();
if (scroll > position) {
console.log( 'scrollDown' );
$( 'div' ).text( '向下滚动' );
} else {
console.log( 'scrollUp' );
$( 'div' ).text( '向上滚动' );
}
position = scroll;
});
</script>
</body>
</html>
|
相关免费学习推荐:JavaScript(视频)
以上就是jquery怎样才能确定滚动事件的方向的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
jQuery怎么判断单选按钮是否选中
jQuery如何解除事件绑定?
jQuery是干嘛的
jQuery file是什么意思
jQuery :lang()怎么用
jQuery判断是否存在class的方法
jQuery可以删除所有的子元素吗?
jQuery如何判断是否按下了enter键
jQuery easyui 乱码怎么办
jQuery怎么判断元素是否在数组中
更多相关阅读请进入《jQuery》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » jquery怎样才能确定滚动事件的方向