2025-02-17

$(function(){ 
    var $comment = $('#comment');  //獲取評論框  
    $('.bigger').click(function(){ //放大按鈕綁定單擊事件  
       if(!$comment.is(":animated")){ //判斷是否處於動畫  
          if( $comment.height() < 500 ){  
                $comment.animate({ height : "+=50" },400); //重新設置高度,在原有的基礎上加50  
          } 
        } 
    }) 
    $('.smaller').click(function(){//縮小按鈕綁定單擊事件  
       if(!$comment.is(":animated")){//判斷是否處於動畫  
            if( $comment.height() > 50 ){ 
                $comment.animate({ height : "-=50" },400); //重新設置高度,在原有的基礎上減50  
            } 
        } 
    }); 
}); 

摘自 chaojie2009的專欄

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *