0

如何在一个脚本中更改图库项目时添加禁用右键单击(添加水印)和淡化内容。

我的代码不起作用:

$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
    nextMethod : 'resizeIn',
    nextSpeed  : 250,

    prevMethod : false,

    helpers : {
        title : {
            type : 'inside'
        }
    }
 });

$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
    beforeShow: function () {
        /* Disable right click */
        $.fancybox.wrap.bind("contextmenu", function (e) {
                return false; 
        });
    }
 });
4

1 回答 1

1

将您想要的所有 API 选项放在一个脚本 init 中(只需用逗号分隔它们,但最后一个)

$(".fancybox")
.attr('rel', 'gallery')
.fancybox({
    nextMethod : 'resizeIn',
    nextSpeed  : 250,
    prevMethod : false,
    helpers : {
        title : {
            type : 'inside'
        }
    },
    beforeShow: function () {
        /* Disable right click */
        $.fancybox.wrap.bind("contextmenu", function (e) {
                return false; 
        });
    }
    // ,
    // some other options or callbacks go here
 });
于 2013-07-09T16:02:02.280 回答