加载所有"jquery移动页面"在通过ajax获取的html文档中 [英] load all "jquery mobile pages" within a html document fetched via ajax

查看:85
本文介绍了加载所有"jquery移动页面"在通过ajax获取的html文档中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请让我知道如何将html文档中的所有页面"加载到当前页面dom中. 我尝试使用$ .mobile.loadPage,但是仅加载了文档的第一个页面". 我想加载该html文档中的所有页面".

Please let me know how to load all the "pages" in a html document into the current page dom. I tried using $.mobile.loadPage, but only the first "page" of the document is loaded. I want to load all the "pages" in that html document.

为此,我发现了两个插件ToddThomson/jQuery-Mobile-Subpage-Widget和一个multiview插件.但是我找不到这两个插件的基本如何使用"部分.

While googling for this i found two plugins ToddThomson/jQuery-Mobile-Subpage-Widget and a multiview plugin. But i could not find the basic "how to use" section for these two plugins.

是否有任何链接显示如何使用这些插件.

Is there any links which shows how to use these plugins.

推荐答案

可以轻松完成.

假设您有2个html文件.第一个有一个jQM页面,第二个html有两个页面.还可以说第一个html页面称为test1.html,第二个html页面称为test2.html,test1.html是要打开的第一页.

Lets say you have 2 html files. First one has a one jQM page and second html has two pages. Also lets say first html page is called test1.html and second one is called test2.html, test1.html is first page to open.

(从test2.html加载每个页面)您只需要做的就是将 data-prefetch 属性添加到标签链接指向第二页.

Only thing you need to do (to load every page from test2.html) is to add an attribute data-prefetch to a a tag link leading to the second page.

这是一个例子:

<a href="test2.html" class="ui-btn-right" data-prefetch>Next</a>

如果您愿意,请转到我的个人资料并给我发送电子邮件,我将向您发送一个工作示例.

If you wish, go to my profile and send me an email, and I will send you a working example.

您可以在jQM中找到有关数据预取的更多信息: http://jquerymobile .com/test/docs/pages/page-cache.html

Here you can find more about data prefetch in jQM: http://jquerymobile.com/test/docs/pages/page-cache.html

如果要使用changePage函数更改页面,您仍然可以使用:

If you are changing your page with a changePage function you can still prefetch it with a :

pageContainerElement.page({ domCache: true });

这篇关于加载所有"jquery移动页面"在通过ajax获取的html文档中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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