jeryM
 

JS控制滚动条的位置:
window.scrollTo(x,y);

竖向滚动条置顶(window.scrollTo(0,0);
竖向滚动条置底 window.scrollTo(0,document.body.scrollHeight)

JS控制TextArea滚动条自动滚动到最下部

document.getElementByIdx_x(\'textarea\').scrollTop = document.getElementByIdx_x(\'textarea\').scrollHeight

 

获得滚动条距离顶部位置

function getScrollTop(){
var scrollTop=0;
if(document.documentElement&&document.documentElement.scrollTop){
scrollTop=document.documentElement.scrollTop;
}else if(document.body){
scrollTop=document.body.scrollTop;
}
return scrollTop;
}

分类:

技术点:

相关文章:

  • 2021-11-07
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2023-03-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-06
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案