代码之家  ›  专栏  ›  技术社区  ›  user3386779

仅在颜色框中显示内容

  •  0
  • user3386779  · 技术社区  · 8 年前

    display:none css到'。ajax的内容不会显示在colorbox中。如果添加删除,则在关闭弹出窗口后显示内容。我想在关闭弹出窗口后消失内容

    Fiddle

    <div class="ajax" >
       <img src="https://www.w3schools.com/html/pic_mountain.jpg"/>
       <p>Hello, world!</p>
    </div>
    
    $(document).ready(function(){
        $.colorbox({inline:true, href:".ajax"});
    });
    
    2 回复  |  直到 8 年前
        1
  •  1
  •   Carsten Løvbo Andersen Dan Nemtanu    8 年前

    您可以使用 onClose

    onClosed: function() {
      $('.ajax').hide()
    }
    

    $(document).ready(function() {
      $.colorbox({
        inline: true,
        href: ".ajax",
        onClosed: function() {
          $('.ajax').hide()
    
        }
      });
    });
    
        2
  •  1
  •   Ankit Singh    8 年前

    试试这个:

    $(document).ready(function(){
        $.colorbox({
            inline:true,
            href:".ajax",
            onClosed: function () { // Close event of colorbox
               $('div.ajax').hide();
            }
        });
    });