2009-10-01 4 views
0

div를 낮추고 올리는 블라인드 기능이 있습니다. 그것은 잘 작동하지만 div가 30px를 제외한 모든 방법으로 내려 가서 끝까지 열 수 있도록 만들고 싶습니다. 어떻게하면 좋을까요?JQuery 블라인드 기능 - 30px

// * JQuery와 * //

jQuery.fn.blindToggle = function(speed, easing, callback) { 
     var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom')); 
     return this.animate({marginTop: parseInt(this.css('marginTop')) >0 ? 0 : +h }, speed, easing, callback); 
    }; 

$(document).ready(function() { 
    var $box = $('#box') 
    .wrap('<div id="box-outer"></div>'); 
    $('#blind').click(function() { 
    $box.blindToggle('slow'); 
    });  
}); 

// * CSS * //

#box { 
    padding: 10px; 
    height: 100px; 
    width: 100px; 
    background: #e459e9; 
    } 
#box-outer { 
    overflow: hidden; 
    height: 120px; 
    margin: 20px; 
    } 

감사합니다!

+0

nativ Jquery blind 기능을 확인 했습니까? http://docs.jquery.com/UI/Effects/Blind – powtac

답변

0

여기 왜이 기회를주지 않습니까?

jQuery.fn.blindToggle = function(newHeight, speed, easing, callback) { 
    return this.each(function(){with(jQuery(this)){ 
     height() != newHeight ? 
      data("wasHeight", height()).css("overflow","hidden").animate({height: newHeight}, speed, easing, callback) 
     : 
      css("overflow","").animate({height: data("wasHeight")}, speed, easing, callback).removeData("wasHeight") 
    }}) 
}; 

$(function() { 
    $('#blind').click(function() { 
    $(this).blindToggle(30, "slow"); 
    });  
});