auto scroll to bottom of page with jquery

前端 未结 8 1367
自闭症患者
自闭症患者 2020-12-29 05:30

How can i auto scroll to bottom of page with jquery becuase i am requesting xmlhttp to update content of page

相关标签:
8条回答
  • 2020-12-29 05:45

    To cover all scenarios: Consider scrolling an overflowed div where height is not the same as scrollHeight. (remove the animate part if its not needed):

    $('#myDiv').animate({
        scrollTop: $('#myDiv').get(0).scrollHeight
    }, 1500);
    
    0 讨论(0)
  • 2020-12-29 05:47

    This Code work for me:-

    jQuery("html, body").animate({ scrollTop: jQuery(window).height()}, 1500);
    
    0 讨论(0)
  • 2020-12-29 05:54

    A lot of the scrollHeight implementations didn't work for me, offsetHeight seemed to do the trick.

    Pretty sure that scrollHeight tries to move it to the bottom of the height of the static element, not the height of the scrollable area.

    var pane = document.getElementById('pane');
    pane.scrollTop = pane.offsetHeight;
    
    0 讨论(0)
  • 2020-12-29 06:01

    auto scroll to bottom of page with jquery (Best):

    $(function () {
               $("html, body").animate({
    scrollTop: $('html, body').get(0).scrollHeight}, 1000);});
    

    Demo

    0 讨论(0)
  • 2020-12-29 06:03
    function scroll(){
      $('html, body').animate({
        scrollTop: $("#footerOfPage").offset().top
      }, 0);
    }
    
    0 讨论(0)
  • 2020-12-29 06:09

    in my case it's:

     myscroll = $('#myDiv');
      myscroll.scrollTop(myscroll.get(0).scrollHeight);
    
    0 讨论(0)
提交回复
热议问题