텍스트 상자 확대, 축소, 위로, 아래로

1831 단어
.bigger , .down , .up , .smaller{
    background-color: #f1a55c;
} 
 $(function(){
          var $comment = $('#comment');
          $('.bigger').click(function(){
              if(!$comment.is(":animated")){
                  if($comment.height() < 500){
                      //$comment.height($comment.height() + 50);
                      $comment.animate({height:"+=50"},400);
                  }
              }
          });
           $('.smaller').click(function(){
               if(!$comment.is(":animated")){
                   if($comment.height() > 50){
                       //$comment.height($comment.height() - 50);
                       $comment.animate({height:"-=50"},400);
                   }
               }
           });
           $('.up').click(function(){
              if(!$comment.is(":animated")){
                  $comment.animate({scrollTop:"-=50"},400);
              }
           });
           $('.down').click(function(){
               if(!$comment.is(":animated")){
                   $comment.animate({scrollTop:"+=50"},400);
               }
           });
       }); 
<div class="msg">
       <div class="msg_caption">
           <span class="bigger"> </span>
           <span class="smaller"> </span>
           <span class="up"> </span>
           <span class="down"> </span>
       </div>
        <div>
            <textarea id="comment" rows="8" cols="20">
                  
                 
                 
                 
            </textarea>
        </div>
    </div>

좋은 웹페이지 즐겨찾기