2014-11-09 4 views
0

그래서이 부분 뷰를 렌더링하는 코드 :애니메이션 부분보기

$(".user").click(function() { 

     var id = $(this).attr("data-id"); 
     $.ajax({ 
      url: "/Home/ShowUser?xid=" + id, 
      contentType: 'application/html; charset-utf-8', 
      type: 'GET', 
      dataType: 'html' 
     }) 
      .success(function (result) { 
       $('#showuser').html(result); //<-Add an effect? 

      }); 
    }); 

이 부분을 애니메이션하기 위해 같은 JQuery와 slideDown 같은 또는 soething를 사용할 수 있습니까?

감사합니다.

답변

2

먼저 document.ready 이벤트에 slidUp 당신의 #showuser div의 다음 slideDown을 아약스 성공 즉 후 :

$(document).ready(function(){ 

    $('#showuser').slideUp(); 

    $(".user").click(function() { 

      var id = $(this).attr("data-id"); 
      $.ajax({ 
       url: "/Home/ShowUser?xid=" + id, 
       contentType: 'application/html; charset-utf-8', 
       type: 'GET', 
       dataType: 'html', 
       .success(function (result) { 
        $('#showuser').html(result);   // first setting html 
        $('#showuser').slideDown(500);   // then sliding it down 
       }); 
    }); 

)}; 
+0

딱! 가능한 한 빨리 답변으로 받아 들일 것입니다! – Wranglerino