jQuery 在 Fancybox 中隐藏关闭的“X”按钮

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1739669/
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 12:04:13  来源:igfitidea点击:

Hide the close "X" button in Fancybox

jqueryhtmlfancybox

提问by HP.

I am using this http://fancybox.net/

我正在使用这个http://fancybox.net/

Is there a way to add a property to not show the close "X" button on top right? I mean I can use 'callbackOnShow' to hide it in a hide() but that is not fast enough. I want it NOT rendered out instead of rendered then hide.

有没有办法添加一个属性来不显示右上角的关闭“X”按钮?我的意思是我可以使用 'callbackOnShow' 将它隐藏在 hide() 中,但这还不够快。我希望它不被渲染而不是渲染然后隐藏。

回答by Yogesh Agarwal

Looks like showCloseButtondoesn't work any more. After looking into the fancybox code i figured out closeBtnshould be set to false.

好像showCloseButton已经不行了。在查看了fancybox 代码后,我发现closeBtn应该设置为false。

So in order to hide close button one should add below line in options -

因此,为了隐藏关闭按钮,应在选项中添加以下行 -

'closeBtn' : false

'closeBtn' : false

回答by Quintin Robinson

If you take a look at the documentation at http://fancybox.net/apiit cites an option of showCloseButtonthat should do the trick.

如果您查看http://fancybox.net/api上的文档,它会引用一个选项来解决问题showCloseButton

From the site:

从网站:

showCloseButton - Option to show/hide close button

showCloseButton - 显示/隐藏关闭按钮的选项

回答by user2368724

In fancybox 3 use 'modal' e.g.

在fancybox 3 中使用'modal' 例如

        $.fancybox.open({
            ...
            opts: {
                modal: true,
            }
        });

回答by Lucas Veiga

For those who are looking for disable it completely in fancybox v3, here it is:

对于那些正在寻找在fancybox v3中完全禁用它的人,这里是:

smallBtn: false,
toolbar: false

回答by vineet

use boolean in 'showCloseButton' attribute. e.g

在“showCloseButton”属性中使用布尔值。例如

$('.editGnBtn').fancybox({
   'href': "#editGn",
   'showCloseButton':false
 });

回答by Vijay Srinivas

You can add the following in ... .fancybox-close {display:none; }

您可以在...中添加以下内容 .fancybox-close {display:none; }

But it is advisable only if the same fancyboxis a popup which will automatically disappear after some time (using $.fancybox.close();)

但只有当同一个fancybox是一个弹出窗口时才可取,它会在一段时间后自动消失(使用$.fancybox.close();