2013-07-29 23 views
1

lazyload和jquery mobile之間的衝突打破了在Phonegap iOS版本中使用$.mobile.changePage$.mobile.navigate的預期結果。lazyload()打破jQuery Mobile changePage並在iOS電話中導航

儘管它在桌面瀏覽器中可用,但不適用於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.originalEvent問題是undefined

回答

0

以下補丁可以解決問題。但是,這也已在最新版本的插件中得到修復。

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