scrollTo gets overridden when using jQuery Mobile

大城市里の小女人 提交于 2019-12-02 09:12:35

jQuery Mobile has a special scroll function $.mobile.silentScroll(). It scrolls without animation but at the same time it doesn't trigger scroll event.

You also need to wait until page is fully loaded into DOM before calling this function. You can bind it to pagebeforeshow or pageshow.

$(document).on("pagebeforeshow", "#page", function () {
    setTimeout(function () {
        $.mobile.silentScroll(100);
    }, 10);
});

Demo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!