PhotoSwipe手机端图片弹出显示插件【使用笔记】
作者:互联网
代码下载地址:
http://down.51cto.com/data/2303672
特别注意:使用的时候会报错:
在移动端开发时使用photoswipe插件报错 Uncaught TypeError: Cannot read property 'x' of undefined
解决办法:
https://www.cnblogs.com/zxlshare/p/6472418.html
//处理:photoswipe插件报错 Uncaught TypeError: Cannot read property 'x' of undefined
function setpic() {
$(".demo-gallery img").each(function () {
var imgs = new Image();
imgs.src = $(this).attr("src");
var w = imgs.width * 10, h = imgs.height * 10;
$(this).parent("a").attr("data-size", "").attr("data-size", w + "x" + h);
})
}
标签:插件,attr,PhotoSwipe,笔记,photoswipe,报错,imgs,data 来源: https://blog.51cto.com/xuqin/2379982