vue滾動條事件(獲取滾動條距離底部距離)


<div  class="main" @scroll.passive="getScroll($event)" style="height:100px;overflow:auto;">
    <ul>
      <li>內容</li>
    </ul>
 </div>

.main{
  width: calc(1125vw / 11.25);
  height: 100%;
  overflow-y: scroll;
}
 
getScroll( event ) {
       // 滾動條距離底部的距離scrollBottom
       let  scrollBottom =
         event .target.scrollHeight -
         event .target.scrollTop -
         event .target.clientHeight;
       // if (this.finished && scrollBottom < 40) {
       //  操作
       // }
     },


免責聲明!

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



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