jQuery实现滚动条滚动到子元素位置(方便定位)
话不多说,请看代码:
<divclass="of-y"id="nurse"> <tableclass="highwidth"id="nurse-plan"> <trid="tr-one"></tr> <trid="tr-two"></tr> <trid="tr-three"></tr> <trid="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);--有动画效果
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持毛票票!
热门推荐
10 祝女儿简短祝福语大全
11 大学新年祝福语简短创意
12 元旦适合的祝福语简短
13 朋友出远门祝福语简短
14 初六简短的祝福语
15 祝男孩生日祝福语简短
16 同事调离的祝福语简短
17 拜年红包的祝福语简短
18 妈妈生日祝福语简短励志