载入中jQuery Mobile的多页文件 [英] loading a multipage file in jquery mobile

查看:118
本文介绍了载入中jQuery Mobile的多页文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过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);
 

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");

这篇关于载入中jQuery Mobile的多页文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆