jQuery Colorbox - 从特定窗口中删除关闭按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2685282/
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
Colorbox - removing the close button from a specific window
提问by Yael
I'm using the colorbox plugin to display messages on my web page. One of them is a "wait for response" message, and I don't want the user closing it by himself.
我正在使用 colorbox 插件在我的网页上显示消息。其中之一是“等待响应”消息,我不希望用户自己关闭它。
I know how to unbind the ESC key, and to disable the overlay close, but I still have a problem with the close button. I found I could remove it in the css like this: #cboxClose{display:none !important;} but this will effect all my colorbox messages..
我知道如何解除 ESC 键的绑定,并禁用覆盖关闭,但我仍然有关闭按钮的问题。我发现我可以像这样在 css 中删除它:#cboxClose{display:none !important;} 但这会影响我所有的颜色框消息..
Is there a way to remove the close button from a specific message? Maybe from the jsp itself?
有没有办法从特定消息中删除关闭按钮?也许来自jsp本身?
Thanks, Yael.
谢谢,耶尔。
回答by ntziolis
What about removing the button after this specific box has opened via jquery. Colorbox provides you with the necessary event hook:
在通过 jquery 打开此特定框后删除按钮怎么样。Colorbox 为您提供了必要的事件挂钩:
$('selector').colorbox({onLoad: function() {
$('#cboxClose').remove();
}});
回答by bjtilley
Thanks ntziolis this is exactly what I was looking for. I was able to add this to my colorbox call like so. I am using it to open a separate web page, notice the iframe:true
谢谢ntziolis,这正是我要找的。我能够像这样将它添加到我的 colorbox 调用中。我用它来打开一个单独的网页,注意 iframe:true
$(".class_name").colorbox({innerWidth:500, innerHeight:400, iframe:true, escKey:false, overlayClose:false,onLoad: function() {
$('#cboxClose').remove();
}});
回答by Gohel Kiran
there is a option in newer version of colorbox
较新版本的 colorbox 有一个选项
closeButton true Set to false to remove the close button.
closeButton true 设置为 false 以删除关闭按钮。
see here http://www.Hymanlmoore.com/colorbox/
见这里 http://www.Hymanlmoore.com/colorbox/
closeButton: false
关闭按钮:假