jQ 操作滾動條滾動到指定位置


jQ:scrollTop()  方法設置或返回被選元素的垂直滾動條位置,

$(selector).scrollTop(position)  position:規定以像素為單位的垂直滾動條位置。

if(item.id == changeInfo.value) {
     let id = treeData[i].id,
         childrenLen = $('#' + id).next().find('.tree-second-node').length,
         h = childrenLen * 28,
         scrollH = ($('#' + item.id).parent().offset().top - this.height);
     $('#' + id).next().animate({'height':h + 'px'});
     setTimeout(() => {
         $('.defined-parts').animate({scrollTop: scrollH});
         $('#' + item.id).parent().addClass('active');
     },500)}

 

 

 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM