weixin_33734785 2012-06-09 21:19 采纳率: 0%
浏览 25

colorbox div将不会显示

I am trying to show a hidden div in a colorbox on click

I cant figure out how to show the div inside the colorbox

the div is hidden, but I want it to be visible when it is displayed inside the colorbox obviously

<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" }); 
});

this works only when the form messageform is not hidden, but how can i show on click in the colorbox?

  • 写回答

2条回答 默认 最新

  • weixin_33709364 2012-06-09 21:25
    关注

    You can either wrap the messageform inside a div that has display:none or you can set it to show on click:

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

    Here is a demo with a container that is set to display none:http://jsfiddle.net/fbenariac/4vuDC/

    Also you could use the colorbox events to show/hide: 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();
                }
               }); 
    });​
    
    评论

报告相同问题?

悬赏问题

  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面