javascript - jquery 移动对话框不会在第一页加载时打开

标签 javascript jquery mobile jquery-mobile dialog

根据文档,我在使用多页对话框时遇到了问题。我遇到一个问题,在初次访问具有对话框(多页)的页面时,单击打开对话框的按钮,它不起作用。但是,如果我随后刷新页面,然后再次单击该按钮,对话框就会正常显示。这发生在所有设备上。

有什么想法可以从哪里开始?我检查了代码验证,唯一缺少的是某些图像上的一些 alt 标签。

这是一个链接:

http://bit.ly/wTnpgi

点击画廊然后“浏览画廊”

更新 1

我发现了一个有趣的结果。如果我通过链接从另一个页面访问该页面(即:从主页转到图库),该对话框将不起作用。但是,如果我通过网络浏览器地址栏直接转到 url,它确实有效。因此,它与推荐和可能的 ajax 页面加载有关。

最佳答案

我想通了。我越来越深入地阅读文档,并在 http://jquerymobile.com/demos/1.0a4.1/docs/pages/docs-pages.html 上偶然发现了这一段。 :

It's important to note 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.

For example, a link to a page containing multiple internal pages would look like this: Multi-page link

当我将 rel 添加到推荐链接时,它起作用了。欢乐时光。

关于javascript - jquery 移动对话框不会在第一页加载时打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8965286/

相关文章:

javascript - 如何刷新 CSS 以便动态生成的元素可以设置样式?

javascript - 网站在旧版 Internet Explorer 中无法正常显示

javascript - 点击 : Passing String as Parameter

javascript - JQuery $.post 关于提交事件帮助

javascript - 移动 webkit 浏览器在 JS 中是否存在舍入问题?

javascript - 如果我使用过滤器工具栏搜索,jqgrid 水平滚动条丢失

javascript - jQuery.getJSON 回调中设置的变量不会保留其值

jquery - 谷歌地图 : How to rotate `groundoverlay` need trick

javascript - 温泉 UI 分页 : navigator and tabbar

iphone - 有什么可以在原生移动应用程序中实现而在 HTML5 网络应用程序中无法实现的?