话不多说,请看代码:
<div class="of-y" id="nurse" >
<table class="high width" id="nurse-plan">
<tr id="tr-one"></tr>
<tr id="tr-two"></tr>
<tr id="tr-three"></tr>
<tr id="tr-four"></tr>
</table>
</div>
jQuery:
$("#nurse").scrollTop($("#nurse").scrollTop() + $('#tr-three').offset().top - $("#nurse").offset().top); --普通
$("#nurse").animate({ scrollTop: $("#nurse").scrollTop() + $('#tr-three').offset().top - $("#nurse").offset().top }, 1000); --有动画效果
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!
最后
以上就是可爱糖豆最近收集整理的关于jQuery实现滚动条滚动到子元素位置(方便定位)的全部内容,更多相关jQuery实现滚动条滚动到子元素位置(方便定位)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复