I need to add images that should be swiped right and left, instead getting this error in 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
where the 59th line is this }(window, window.jQuery, window.Code.PhotoSwipe));
which comes under the below code. i have included swiper file and referenced correctly, still not able to get, please help me.
(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));
Please check below fiddle and the discussions. It was something similar to your issue.
http://jsfiddle.net/Purus/vBvLK/3/
You don't need to wrap the code insdie Photoswipe function. The below line is enough.
var $s = $("#gridView a").photoSwipe();
Also see PhotoSwipe: populate / switch image gallery from localStorage?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.