Jquery mobile - onhashchange issue

后端 未结 2 1608
一向
一向 2021-01-24 15:33

I am using $.mobile in my app. I must create my own routing system. I bind observer on hashchange and I pull out interesting data from location.h

相关标签:
2条回答
  • 2021-01-24 15:59

    in your html after including jquery and before including jquery.mobile-1.x.y.js add:

    <script>
    $(document).bind("mobileinit", function(){
            $.mobile.pushStateEnabled = false;
            $.mobile.ajaxEnabled = false;
            $.mobile.hashListeningEnabled = false;
    });
    </script>
    
    0 讨论(0)
  • 2021-01-24 16:02

    I believe you are fighting against the "pushState" plugin in jQuery Mobile added in Beta 3 (I believe). You can disable this plugin with the following code (used before you include the jQuery Mobile JavaScript file):

    $(document).on('mobileinit', function () {
        $.mobile.pushStateEnabled = false;
    });
    

    Check-out the documentation here (notice the "pushState Plugin" section): http://jquerymobile.com/demos/1.0rc3/docs/pages/page-navmodel.html

    0 讨论(0)
提交回复
热议问题