jQuery scrollTop() does not work in scrolling DIV on mobile browsers, alternatives?

前端 未结 13 987
傲寒
傲寒 2020-12-08 19:52

I am trying to scroll to a specific location in a scrolling DIV. Right now I am using a pixel offset with the jQuery scrollTop() function which works great on desktop brows

13条回答
  •  天命终不由人
    2020-12-08 20:20

    The only way i could achieve scrolling to the top of the page on a Galaxy Tab was hiding the page body for 100ms while scrolling. Using jQuery:

    $("body").hide();
    window.scrollTo(0, 0);
    setTimeout(function(){ $("body").show() }, 100);
    

提交回复
热议问题