Why I have to put all the script to index.html in jquery mobile

后端 未结 3 1304
闹比i
闹比i 2020-11-22 07:02

I have used $.mobile.changepage to do the redirect in my phonegap+jquerymobile projects. However what makes me confused is that I need to put the script of all the pages to

3条回答
  •  一向
    一向 (楼主)
    2020-11-22 07:32

    Jquery Mobile uses ajax to load a "page". A "page" here is a div with data-role=page. If you load a physical page index.html, you can navigate using changePage to any "page" div inside that page.

    However, if you want to load a "page" from other physical page, jQM will only load the first "page" div from that page. What actually happen is you do not change page, jQM just load that particular "page" div using ajax and inject it to your current page.

    You have two possible architecture where you put all your "pages" in a html page and navigate from there. Or you can have multiple page architecture. You can always mix this.

    To physically change page, you need to add rel=external to your link.

提交回复
热议问题