小编Po *_*ong的帖子

如何将图像放大 120%、150% 和 180%?

感谢您阅读我的帖子。

我正在使用放大弹出窗口 - 缩放功能。我想知道如何设置缩放百分比,以及如何通过单击弹出图像来进行 3 种不同程度的放大。

只是想澄清我的障碍:例如,我想单击放大的弹出图像,然后放大到120%,第二次单击,放大到150%,第三次单击,放大到180%,然后第四次单击 ,将缩小回 100%。

有谁知道这是怎么做到的吗?如果是的话,对我有很大帮助。非常感谢!

原始代码(有效):


$('#img').magnificPopup({ 
          delegate: 'a',
          type: 'image',
          callbacks: {
              open: function() {
                $(".mfp-figure figure").css("cursor", "zoom-in");
                $(".mfp-figure figure").zoom({ 
                    on: "click",
                    onZoomIn: function () {
                        $(this).css("cursor", "zoom-out");
                    },
                    onZoomOut: function () {
                        $(this).css("cursor", "zoom-in");
                    }
                });
              },
              close: function() {
                // Will fire when popup is closed
              }
              // e.t.c.
            }
        });
Run Code Online (Sandbox Code Playgroud)

我的代码(不起作用):


$('#img').magnificPopup({ 
          delegate: 'a',
          type: 'image',
          callbacks: {
              open: function() {
                $(".mfp-figure figure").css("cursor", "zoom-in");
                $(".mfp-figure figure").zoom({ 
                    on: "click",
                    onZoomIn: function () …
Run Code Online (Sandbox Code Playgroud)

javascript jquery magnific-popup

2
推荐指数
1
解决办法
3831
查看次数

标签 统计

javascript ×1

jquery ×1

magnific-popup ×1