【问题标题】:lazyload() breaks jQuery Mobile changePage and navigate in iOS phonegaplazyload() 打破 jQuery Mobile changePage 并在 iOS phonegap 中导航
【发布时间】:2013-07-29 21:32:07
【问题描述】:

lazyload 和 jquery mobile 之间的冲突破坏了在 phonegap iOS 构建中使用 $.mobile.changePage$.mobile.navigate 的预期结果。

虽然它适用于桌面浏览器,但不适用于 iOS 版本(例如 phonegap 提供的那些)。

问题是由这部分代码引起的:

/* With IOS5 force loading images when navigating with back button. */
        /* Non optimal workaround. */
        if ((/iphone|ipod|ipad.*os 5/gi).test(navigator.appVersion)) {
            $window.bind("pageshow", function(event) {
                if (event.originalEvent.persisted) {
                    elements.each(function() {
                        $(this).trigger("appear");
                    });
                }
            });
        }

堆栈跟踪中的问题是event.originalEventundefined

【问题讨论】:

    标签: jquery ios jquery-mobile cordova jquery-lazyload


    【解决方案1】:

    以下补丁将解决此问题。不过,这个问题也已在最新版本的插件中得到修复。

    if (event.originalEvent && event.originalEvent.persisted) {
        elements.each(function() {
            $(this).trigger("appear");
        });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多