JQuery Mobile内部哈希链接不起作用 [英] JQuery Mobile internal hash links not working
问题描述
我正在使用JQuery Mobile创建一个移动网站。我有链接到div的内部链接。第一个工作,但第二个链接,除了链接和文本,具有完全相同的格式,不起作用。有什么原因吗?
I am creating a mobile website with JQuery Mobile. I have internal links which link to divs. The first one works, but the second link, which has the exact same format except for the link and text, doesn't work. Any reason why?
推荐答案
您使用多个 data-role =page
在您的代码中?
如果是这样,您需要使用子页面小部件,并将子项页
替换为子页面
。
Are you using multiple data-role="page"
's in your code?
If so, you'll need to use the subpage widget and replace the children page
's with "subpage
".
注意:您无法链接到激活Ajax导航的多页文档,因为框架只会加载第一个它找到的页面,而不是整套内部页面。在这些情况下,您必须在没有Ajax的情况下链接(请参阅下一节)以进行整页刷新以防止潜在的哈希冲突。目前有一个子页面插件可以加载多页文档。
Note: You cannot link to a multipage document with Ajax navigation active because the framework will only load the first page it finds, not the full set of internal pages. In these cases, you must link without Ajax (see next section) for a full page refresh to prevent potential hash collisions. There is currently a subpage plugin that makes it possible to load in multi-page documents.
这篇关于JQuery Mobile内部哈希链接不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!