PhotoSwipe手机端图片弹出显示插件【使用笔记】

官网:https://photoswipe.com/

代码下载地址:
http://down.51cto.com/data/2303672

PhotoSwipe手机端图片弹出显示插件【使用笔记】

特别注意:使用的时候会报错:

在移动端开发时使用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);
            })
        }

猜你喜欢

转载自blog.51cto.com/xuqin/2379982