jQuery Fancybox 关闭按钮不显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17466635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 19:09:33  来源:igfitidea点击:

Fancybox close button does not show

jqueryfancyboxpartial-views

提问by Trevor Gowing

I'm opening a partial view with fancybox2.1.4 but I cant get the closing cross to show. Does anyone know what I am doing wrong ?

我正在用fancybox2.1.4打开一个局部视图,但我无法显示结束十字。有谁知道我做错了什么?

The box with the content does show:

包含内容的框确实显示:

 function LaunchFancyBox(code) {
    jQuery.fancybox({
        'modal': true,
        'closeBtn': true,
        'content': code
    });
}

$('.sendSms').click(function () {
    $.ajax({
        url: '@Url.Action("Index", "Sms")',
        success: function (partial) {
            LaunchFancyBox(partial);
        },
    });
    return false;
});

回答by Trevor Gowing

From the the documentation:

文档中

modal If set to true, will disable navigation and closing
Boolean; Default value: false

modal 如果设置为 true,将禁用导航和关闭
布尔值;默认值:false

Do not set the modal parameter to true

不要将 modal 参数设置为 true

回答by Md. Rahman

closeBtn: 'true',
afterShow: function () {
   $('.fancybox-close').attr('id', 'fancybox-close');
}

css

css

#fancybox-close {
display:inline !important;
top: -7px !important;
right: 1px !important;
width: 28px !important;
height: 30px !important;

}

And add "fancybox.png" to the same directory of "jquery.fancybox-1.3.4.css"

并将“fancybox.png”添加到“jquery.fancybox-1.3.4.css”的同一目录中

Download From Here http://www.imagemagick.org/fancybox/fancybox.png

从这里下载http://www.imagemagick.org/fancybox/fancybox.png

回答by Jizbo Jonez

The code you are using looks correct. Make sure you have uploaded the fancybox_sprite.png to wherever you have the main fancybox javascript and css files located, ie. in same folder.

您使用的代码看起来是正确的。确保您已将fancybox_sprite.png 上传到您拥有主要fancybox javascript 和css 文件的任何位置,即。在同一个文件夹中。