1、当前滚动的地方的窗口顶端到整个页面顶端的距离:
var winPos = $(window).scrollTop();
2、获取指定元素的页面位置:
$(val).offset().top;
3、对页面滚动条滚动的监听:要放在页面加载的时候
$(window).scroll(function(event)});
4、设置滚动条到指定位置。
$(window).scrollTop(offset)。
5、jQuery('#item').outerHeight()
#item 的实际尺寸,即 height+padding+border
6、jquery('#item').outerheight(true)
#item的实际尺寸及外边距,即 height+padding+border+margin
相关推荐:
以上就是关于js可视距离的方法总结的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号