带 jQuery-Mobile 的对话框插件
我发现如果我使用另一个覆盖/对话框插件,如 Clearbox 或 fancyBox,我会在覆盖初始化后失去 jQuery-Mobile 的使用功能。对话框正确打开,但我注意到它下面有一个“页面错误”警报 - 我关闭对话框并打开它。那么其他任何东西都不起作用(即:滑动,甚至设备上的后退按钮和 Chrome 浏览器),只有插头(对话框)。
这触发了覆盖:
<a href="res/img/f1_1.jpg" rel="clearbox">Figure 1-1</a>
如果我添加: target="something" 到 a 标签,警报就会消失,一切正常;但是,图像被加载到 DOM 和对话框中 - 这显然是不希望的。是否有修复/解决方法来解决该问题。我真的不想使用 jQuery-Mobile 附带的“现成”对话框。
I found if I use another overlay/dialog plug like Clearbox or fancyBox, I loose the use function of jQuery-Mobile after the overlay initializes. The dialog opens correctly but I notice an "error on page" alert under it - I close the dialog & then nothing else works (ie: swipes & even the back btn on the device & a Chrome browser) only the plug(dialog).
This what triggers the overlay:
<a href="res/img/f1_1.jpg" rel="clearbox">Figure 1-1</a>
If I add: target="something" to the a tag, the alert goes away and all works fine; But, the image is loaded into the DOM and the dialog - This is obviously not desired. Is there a fix/work-a-round to resolve the issue. I really do not want to use the 'in-the-box' dialog that come w/jQuery-Mobile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jQuery Mobile 尝试使用 AJAX 调用将所有链接加载到当前页面。如果我不得不猜测问题是 Clearbox 或 Fancybox 实际上首先处理该事件并且对话框按预期显示。之后我的猜测是 jQuery mobile 尝试处理链接的单击事件并尝试打开链接本身,但那里出了问题。
添加目标起作用的原因是 jQuery Mobile 不会像通常那样处理这些链接。如果您可以使用 rel="external",只要您不需要它为 Clearbox 或 Fancybox 提供不同的值即可工作,则可能会解决该问题。另一种选择是尝试添加 data-ajax="false" 作为 a 标记的属性。
jQuery Mobile tries to load all links into the current page using an AJAX call. If I had to guess the problem is that Clearbox or Fancybox is actually handling the event first and the dialog appears as is expected. After that my guess would be that jQuery mobile tries to handle the click event for the link and tries to open the link itself and something goes awry there.
The reason adding target works is that jQuery Mobile doesn't process those links as it normally would. If you could use rel="external" it might fix the issue as long as you don't need it to have a different value for Clearbox or Fancybox to work. Another option would be to try adding data-ajax="false" as an attribute of the a tag.