自定义scrollBottom的值

it2022-05-09  28

jQuery中只有scrollTop和scrollLeft这两个属性,没有scrollBottom和scrollRight这两个属性。但是我们有很多时候还是要用到scrollBottom,可以根据页面的各种高度高度来获取scrollBottom. $(window).height();//是文档窗口高度$("div").offset().top//是标签距离顶部高度$(document).scrollTop();//是滚动条高度$("div").height();//是标签高度 scrollBottom+$("div").height()+[$("div").offset().top-$(document).scrollTop()]=$(window).height();可得到scrollBottom=$(window).height()-$("div").offset().top-$("div").height()+$(document).scrollTop()。

转载于:https://www.cnblogs.com/czyblog/p/4089279.html


最新回复(0)