How to navigate back one page using $.mobile.changePage

后端 未结 6 1193
长情又很酷
长情又很酷 2021-02-07 04:19

All of the JQuery Mobile documentation I can find about navigating backwards assumes I am going to do this using an anchor tag and suggest I add data-rel=\"back\" t

6条回答
  •  孤城傲影
    2021-02-07 04:58

    You are going back "two levels" because if you fire changePage programmatically via

    $.mobile.changePage('#next', { transition: 'pop' });
    

    and omit all the other options, you are triggering two functions:

    • changePage
    • hashChange

    Normally on a regular transition, the hashChange is blocked, while on backwards transitions, the changePage should be blocked (not sure here...). So in your case you have your (wanted) hashChange and an unwanted (changePage) transition.

    Check the JQM docs for the options you can pass along in your changePage call or look in the 1.0 source code #3140 for all available options. I would try also passing changeHash:false or fromHashChange:true along in your function call and see what happens.

    If you want to dig deeper you will have to look for ignoreNextHashChange and how its value changes though JQM.

提交回复
热议问题