Jquery Colorbox打开两次/次

Jquery Colorbox打开两次/次,jquery,wordpress,colorbox,multiplication,Jquery,Wordpress,Colorbox,Multiplication,我在使用配色箱时遇到问题。我想通过colorbox在WP中打开附件页。页面上有几个大小不同的图像(横向和纵向),因此颜色框的宽度和高度必须灵活。使用默认数据类型是可行的,但是当我第二次单击图像时,最后一个颜色框似乎没有正确关闭。因此,它有两个色盒运行。每次单击图像时,颜色框都会进行乘法运算。你知道怎么解决这个问题吗?多谢各位 <script> $(document).ready(function(){ $('.lightbox').colorbox(); }); &l

我在使用配色箱时遇到问题。我想通过colorbox在WP中打开附件页。页面上有几个大小不同的图像(横向和纵向),因此颜色框的宽度和高度必须灵活。使用默认数据类型是可行的,但是当我第二次单击图像时,最后一个颜色框似乎没有正确关闭。因此,它有两个色盒运行。每次单击图像时,颜色框都会进行乘法运算。你知道怎么解决这个问题吗?多谢各位

<script>
  $(document).ready(function(){
    $('.lightbox').colorbox();
  });
</script>


<div class='image-wrap'>
  <dl class='gallery-item'>
    <dt class='gallery-icon'>
      <a class="lightbox" href='http://localhost/Maize/?attachment_id=122' title='8'>
        <img width="250" height="190" src="http://localhost/Maize/wp-content/uploads/2013/04/8-250x190.jpg" class="attachment-thumbnail" alt="8" />
      </a>
    </dt>
  </dl>
  <dl class='gallery-item'>
    <dt class='gallery-icon'>
       <a class="lightbox" href='http://localhost/Maize/home/home-page/attachment/7/' title='7'>
         <img width="250" height="190" src="http://localhost/Maize/wp-content/uploads/2013/04/7-250x190.jpg" class="attachment-thumbnail" alt="7" />
       </a>
    </dt>
  </dl>
</div>

$(文档).ready(函数(){
$('.lightbox').colorbox();
});

在打开新的颜色框之前,是否关闭上一个?如果没有,您可以尝试调用$.colorbox.close();当您希望第一个灯箱关闭时