官网:https://photoswipe.com/ 代码下载地址: http://down.51cto.com/data/2303672 ![](https://s1.51cto.com/images/blog/201904/17/9218d7e16d463392e39235f8cb69d4d5.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=) # **特别注意:使用的时候会报错:** 在移动端开发时使用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); }) } ```