插件不适用于 jQuery Mobile

发布于 2024-12-11 14:02:03 字数 544 浏览 0 评论 0原文

我在使用 jQuery Mobile 中的 jQuery 插件时遇到问题。在 jQuery Mobile 中,默认情况下所有链接都是通过 AJAX 加载的,这很好,但我的插件在启用 AJAX 的情况下停止工作。如果我禁用它,我的插件会再次工作。

该应用程序可以在此处找到。您必须在 iPhone 上访问该应用程序并“在主屏幕上添加书签”才能解决此问题出现。

登录详细信息为:

用户:chrisb
PASS:120521pot

我正在构建的应用程序是针对 iOS 的,需要在全屏模式下运行,而 AJAX 是全屏正常工作所必需的。我知道脚本正在运行,因为我在 JS 函数中嵌入了一个警报,以显示它已运行,如果我删除与插件关联的任何 JS 文件,则页面为空白,并且不会加载任何内容。

我不确定插件、jQuery Mobile 或我的自定义 js 是否会破坏它,但如果我在没有 AJAX 的情况下加载页面,一切都会正常运行。

非常感谢任何帮助,我正在努力解决这个问题......

I am having trouble with a jQuery plugin in jQuery Mobile. In jQuery mobile all links are loaded via AJAX by default, which is great but my plugin stops working with AJAX enabled. If I disable it, my plugin works again.

The app can be found here. You must visit the app on an iPhone and "Bookmark to the Homescreen" for the issue to appear.

Login details are:

USER:chrisb
PASS:120521pot

The app I'm building is for iOS and needs to run in full screen mode, and AJAX is a must for full screen to work properly. I know the scripts are being run because I have an alert embedded in the JS function to show me it has run and if I remove any of the JS files associated with the plugin then the page is blank and nothing is loaded.

I'm not sure if the plugin, jQuery Mobile or my custom js that is breaking it but if I load the page without AJAX everything runs fine.

Any help is much appreciated, I am banging my head on this one...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独木成林 2024-12-18 14:02:03

为了让插件在 jQuery Mobile 中工作,我连接了 pageshow 事件,然后通过 .ui-page-active 选择器定位当前活动页面:

$(document).on('pageshow', function(e, ui) {
    $('div.ui-page-active .my-element').myPlugin();
});

For plugins to work inside jQuery Mobile, I hooked into the pageshow event and then target the currently active page via .ui-page-active selector:

$(document).on('pageshow', function(e, ui) {
    $('div.ui-page-active .my-element').myPlugin();
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文