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