jQuery实现滚动条滚动到子元素位置(方便定位)
时间:2022-03-31 08:34:04|栏目:jquery|点击: 次
话不多说,请看代码:
<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
本文标题:jQuery实现滚动条滚动到子元素位置(方便定位)
本文地址:http://www.codeinn.net/misctech/197767.html






