我需要添加应该左右滑动的图像,而不是在 logcat 中出现这个错误,10-28 11:48:25.734: E/Web Console(5348): Uncaught TypeError: Cannot read property 'PhotoSwipe' of undefined at file:///android_asset/www/04-jquery-mobile.html:59
其中第 59 行是}(window, window.jQuery, window.Code.PhotoSwipe));
下面的代码。我已包含 swiper 文件并正确引用,仍然无法获取,请帮助我。
(function(window, $, PhotoSwipe){
$(document).ready(function(){
$('div.gallery-page')
.live('pageshow', function(e){
var
currentPage = $(e.target),
options = {},
photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options, currentPage.attr('id'));
return true;
})
.live('pagehide', function(e){
var
currentPage = $(e.target),
photoSwipeInstance = PhotoSwipe.getInstance(currentPage.attr('id'));
if (typeof photoSwipeInstance != "undefined" && photoSwipeInstance != null) {
PhotoSwipe.detatch(photoSwipeInstance);
}
return true;
});
});
}(window, window.jQuery, window.Code.PhotoSwipe));