how to know i reached bottom of table

前端 未结 1 995
北荒
北荒 2021-01-16 13:20

I have a table and i made it scrollable by doing overflow : auto; Now i want to know if the vertical scroll bar reached the bottom so that i can display next 5 row which wer

相关标签:
1条回答
  • 2021-01-16 14:00

    try this

    <script type="text/javascript">
       $(document).ready(function(){
       var tbody = $('#mailServerTbody');
       var heightOfTbody = 0;
       $("#mailServerTbody tr").each(function(){
        heightOfTbody = heightOfTbody + $(this).height();
       });
    
       $('#mailServerTbody').scroll(function(){
    
       if(heightOfTbody == ($(this).scrollTop() + $('#mailServerTbody').height() ))
            {
           alert("reached last")
            }
       });
     });
    </script>
    
    0 讨论(0)
提交回复
热议问题