abstract:本文主要介紹了jQuery實(shí)現(xiàn)滾動(dòng)條滾動(dòng)到子元素位置的方法。具有一定的參考價(jià)值,下面跟著小編一起來看下吧<div class="of-y" id="nurse" > <table class="high width" id="nurse-plan&
本文主要介紹了jQuery實(shí)現(xiàn)滾動(dòng)條滾動(dòng)到子元素位置的方法。具有一定的參考價(jià)值,下面跟著小編一起來看下吧
<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); --有動(dòng)畫效果
更多關(guān)于jQuery實(shí)現(xiàn)滾動(dòng)條滾動(dòng)到子元素位置請(qǐng)關(guān)注PHP中文網(wǎng)(www.miracleart.cn)其他文章!