载入中jQuery Mobile的多页文件载入中、多页、文件、Mobile

由网友(ωǒ想你就撒娇)分享简介:我正在通过AJAX使用jQuery / jQuery Mobile的框架装载两个独立的HTML文件。但是,当我打开第二个文件,它只是加载了第一个div页面的作用。上班什么办法解决此问题?解决方案 这是由设计。当连接多页文档使用相对=外部或数据AJAX =假 要注意,如果你是从一个移动网页链接,这很重要通过Ajax加...

我正在通过AJAX使用jQuery / jQuery Mobile的框架装载两个独立的HTML文件。但是,当我打开第二个文件,它只是加载了第一个div页面的作用。上班什么办法解决此问题?

解决方案

这是由设计。当连接多页文档使用相对=外部数据AJAX =假

  

要注意,如果你是从一个移动网页链接,这很重要   通过Ajax加载到包含多个内部页面的页面,   你需要添加一个相对=外部或数据的ajax =假的链接。   这告诉做一个完整的页面重新加载,以清除框架   阿贾克斯散在URL中。因为AJAX页面使用hash这是关键   (#)来跟踪Ajax的历史,而多个内部页面使用   哈希指示内部网页所以会有中的散列冲突   这两种模式之间

 < A HREF =multipage.html相对=外部>多页链接< / A>
 

如果改变网页编程方式使用

  $ mobile.ajaxEnabled = FALSE。
$ .mobile.changePage(multipage.html);
 
jQuery Mobile之入门

I have two separate html file that are being loaded via ajax using jquery/jquery mobile framework. But when I load the second file, it only loads the first div the the role of page. Any way to work around this?

解决方案

It is by design. When linking a multipage document use rel="external" or data-ajax="false"

It's important to note that if you are linking from a mobile page that was loaded via Ajax to a page that contains multiple internal pages, you need to add a rel="external" or data-ajax="false" to the link. This tells the framework to do a full page reload to clear out the Ajax hash in the URL. This is critical because Ajax pages use the hash (#) to track the Ajax history, while multiple internal pages use the hash to indicate internal pages so there will be conflicts in the hash between these two modes.

<a href="multipage.html" rel="external">Multi-page link</a>

If changing pages programmatically use

$.mobile.ajaxEnabled = false;
$.mobile.changePage("multipage.html");

阅读全文

相关推荐

最新文章