Passing parameters to a page-id in jQuery Mobile

后端 未结 3 1859
無奈伤痛
無奈伤痛 2020-12-01 05:34

I\'m trying to pass some parameters to a page-id made in jQuery Mobile.

The site is composed of list-views with links, each of them has the hash coded in it, like th

3条回答
  •  伪装坚强ぢ
    2020-12-01 06:34

    The plugin doesn't support bookmarking, though. If you add a pagechange handler, you can fix that by putting the params back onto the url after jQM is done with it:

    // list of inner pages where you want to support params AND bookmarking
    // maybe better to use a CSS class name to mark them
    var $paramPages;
    $(document).ready(function() {
        $paramPages = $('#book, #order');
    });
    
    // put the params back into the location once jQM is done
    //
    $( document ).bind( "pagechange", function( e, data ) {
        if (data.toPage.is($paramPages) && data.absUrl) {
            window.location.replace(data.absUrl);
        }
    });
    

提交回复
热议问题