2015-02-07 3 views
2
<HTML> 
    <HEAD> 
     <script src="http://code.jquery.com/jquery-latest.min.js"></script> 
     <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" /> 
     <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script> 
     <script type="text/javascript"> 
      $(document).ready(function(){ 
       $('#delrow').click(function(){ 
        alert(':)'); 
        $(this).closest('tr').animate({'backgroundColor':'#EF3E23','color':'#fff'},300,function(){ 
         $(this).remove(); 
        }); 
        return false; 
       }); 
      }); 
     </script> 
    </HEAD> 
    <BODY> 
    Hello 
     <table> 
      <tr> 
      <td>abc</td> 
      <td><a id="delrow" title="Click to remove" href="#">Delete</a></td> 
      </tr> 
     </table> 
    </BODY> 
</HTML> 

여기 내 코드를 테스트 할 수 있습니다 추가 한 후 작동하지 않습니다 : http://goo.gl/XNQb5j기능 jQuery를 UI

"삭제"버튼을 테이블에서 행을 제거해야합니다. jQuery UI가 포함되어 있지 않을 때 작동합니다 (물론 애니메이션이 작동하지 않습니다). 내가 뭘 잘못하고 있니?

영어 오류로 불편을 끼쳐 드려 죄송합니다.

+0

애니메이션 키입니다. 제대로 작동하지 않아 애니메이션 종료시 콜백이 실행되지 않습니다. – Mouser

답변

1

내가 링크 한 jQuery UI의 버전이 연결된 jQuery의 버전과 호환되지 않습니다. 웹 사이트에서 jQuery 예제의 버전 번호를 더 잘 가져와야합니다. 버전이 호환 때 코드가 어떻게 작동하는지

주의 :

<HTML> 
 

 
<HEAD> 
 
    <script src="http://code.jquery.com/jquery-2.0.2.js"></script> 
 
    <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.css" /> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> 
 
    <script type="text/javascript"> 
 
    $(document).ready(function() { 
 
     $('#delrow').click(function() { 
 
     alert(':)'); 
 
     $(this).closest('tr').animate({ 
 
      'backgroundColor': '#EF3E23', 
 
      'color': '#fff' 
 
     }, 300, function() { 
 
      $(this).remove(); 
 
     }); 
 
     return false; 
 
     }); 
 
    }); 
 
    </script> 
 
</HEAD> 
 

 
<BODY>Hello 
 
    <table> 
 
    <tr> 
 
     <td>abc</td> 
 
     <td><a id="delrow" title="Click to remove" href="#">Delete</a> 
 
     </td> 
 
    </tr> 
 
    </table> 
 
</BODY> 
 

 
</HTML>