2014-09-05 2 views
0

높이를 자동으로 계산하도록 컨테이너를 얻으 려하고 다음 코드를 사용하지만 행운은 없습니다.jQuery 사이클을 사용하여 컨테이너의 자동 높이

컨테이너는

/* <![CDATA[ */ 

var jqu = jQuery.noConflict(); 

jqu(function() { 

    /* Cycle */ 
    jqu('#featured-content').cycle({ 
     slideExpr: '.featured-post', 
     fx: 'fade', 
     speed: 1000, 
     cleartypeNoBg: true, 
     pager: '#slide-thumbs', 
     containerResize: true, 
     slideResize: false, 
     width: '100%', 
     timeout: 5000, 
     prev: '#slider-prev', 
     next: '#slider-next', 
     pagerAnchorBuilder: function(idx, slide) { 
      // return selector string for existing anchor 
      return '#slide-thumbs li:eq(' + idx + ') a'; 
     } 
    }); 
    // call back function to animate the height of the container 
    function onAfter(curr, next, opts, fwd) { 
     var index = opts.currSlide; 
     $('#slider-prev')[index == 0 ? 'hide' : 'show'](); 
     $('#slider-next')[index == opts.slideCount - 1 ? 'hide' : 'show'](); 
     //get the height of the current slide 
     var $ht = $(this).height(); 
     //animates the container's height to that of the current slide 
     $(this).parent().animate({ height: $ht }); 
    } 

}); 


/* ]]> */ 

답변

0

콜백 함수는 또한 http://tny.cz/935e48e2 여기에 "빠른"

$(this).parent().animate({ height: $ht }, "fast");

그냥 추가 코드를 애니메이션을 시도

after: onAfter, 

을 시작하지 # 기능을 갖춘 컨텐츠라고