简体   繁体   English

如何将放大镜jQuery图像放大镜添加到放大的fancybox弹出图像?

[英]How can I add the loupe jQuery image magnifier to enlarged fancybox popup image?

http://jsfiddle.net/warrenkc/svsdx/5440/ see my code so far. http://jsfiddle.net/warrenkc/svsdx/5440/查看到目前为止的代码。

$(document).ready(function () {
    $("#single").fancybox();
    $("#demo-2").loupe();
});

I am looking to add an image magnifier such as loupe to the enlarged image popup from FancyBox. 我想将图像放大镜(如放大镜)添加到FancyBox的放大图像弹出窗口中。 (Useful for users with lower screen resolutions when large images are shrunk by browser) (当浏览器缩小大图像时,对于屏幕分辨率较低的用户很有用)

Does anyone know how to do this? 有谁知道如何做到这一点? Thanks! 谢谢!

Fiddle Demo 小提琴演示

Use afterShow instead of afterLoad 使用afterShow代替afterLoad

$(document).ready(function () {
    $("#single_1").fancybox({
        helpers: {
            title: {
                type: 'float'
            }
        },
        afterShow: function () { //change here 
            $('.fancybox-image').loupe(); //apply loupe after popup has been shown
        }
    });
});

and use css 并使用CSS

as you open fancybox popup it's z-index is 8010 which doesn't allow loupe to show up just give it higher z-index:8020; 当您打开fancybox弹出窗口时,其z-index为8010 ,不允许loupe显示,只需给它更高的z-index:8020; to make it work . 使它工作。

.loupe {
    z-index:8020;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM