2013-06-06 3 views
2

jQuery 플러그인 ColorBox를 사용하고 있습니다.jQuery colorbox resize

내 파일 내부에 jquery hide & slideToggle이 있습니다.

숨겨진 div를 클릭하고 슬라이드하면 colorbox의 높이를 변경해야합니다.

내가 모두 작동하지 colorbox resize 또는 $("#ajax_container").height($("#a").height());

을 시도,이 작업을 수행 할 수있는 방법은 무엇입니까?

<script> 
    $(document).ready(function(){ 
     $("#a").hide(); 

     $("#click_a").click(function(){ 
      $("#a").slideToggle(200); 
      $.colorbox.resize(); 
     }); 
    }); 
</script> 

<style> 
    #ajax_container { 
     width:680px; 
     min-height:400px; 
     overflow:hidden; 
     background:white; 
    } 
    #a { 
     width:500px; 
     height:5500px; 
     background:red; 
     margin-bottom:50px; 
    } 
</style> 

<div id="ajax_container"> 
    <a id="click_a" href="#">Click me</a> 
    <div id="a"></div> 
</div> 
+0

"$ .colorbox.resize();" ** complete ** 콜백 "slideToggle" –

답변

1
$.colorbox.resize({height: 6000}); 

작업을해야한다, 그것으로이를 추가 할 수 있습니다.

0
jQuery(document).ready(function(){ 
    var custom_timeout = (function() { 
     var timers = {}; 
     return function (callback, ms, uniqueId) { 
      if (!uniqueId) { 
       uniqueId = "Don't call this twice without a uniqueId"; 
      } 
      if (timers[uniqueId]) { 
       clearTimeout (timers[uniqueId]); 
      } 
      timers[uniqueId] = setTimeout(callback, ms); 
      }; 
    })(); 
    $(".group1").colorbox({rel:'group1', width:"80%" }); 
    $(window).resize(function(){ 
     custom_timeout(function(){ 
      if($('#cboxOverlay').css('visibility')){ 
       $(".group1").colorbox.resize({ innerWidth:'80%' }); 
      } 
     }, 500); 
    }); 
}); 
+0

죽은 링크를 제거했습니다. –