gpt4 book ai didi

jquery - colorbox div 不会显示

转载 作者:行者123 更新时间:2023-12-01 00:38:11 24 4
gpt4 key购买 nike

我试图在点击时在颜色框中显示隐藏的 div

我不知道如何在颜色框中显示 div

div 是隐藏的,但我希望它在颜色框内明显显示时可见

<div class="test">test</div> // on click

<div id="messageform" style="display: none;"> // show this in colorbox
TEST
</div>



$('.test').click(function(){
$.colorbox({inline:true, width:"50%", open:true, href:"#messageform" });
});

这仅在表单消息表单未隐藏时有效,但如何在颜色框中单击时显示?

最佳答案

您可以将 messageform 包装在具有 display:none 的 div 内,也可以将其设置为在点击时显示:

$('.test').click(function(){
$('#messageform').show();
$.colorbox({inline:true, width:"50%", open:true, href:"#messageform" });
});

这是一个演示,其中的容器设置为不显示: http://jsfiddle.net/fbenariac/4vuDC/

您还可以使用颜色框事件来显示/隐藏:http://jsfiddle.net/lucuma/LK4tt/1/

$('.test').click(function(){

$.colorbox({inline:true, width:"50%", open:true, href:"#messageform",
onClosed: function() {
$('#messageform').hide();
},
onOpen: function() {
$('#messageform').show();
}
});
});​

关于jquery - colorbox div 不会显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10964665/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com