jQuery 튜토리얼을 시작하고 jQuery 애니메이션의로드 순서에 대한 기본적인 질문이 있습니다. 그러나jquery 애니메이션의로드 순서
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a").click(function(event){
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
});
$("a").click(function(event){
event.preventDefault();
$(this).hide("slow");
});
});
</script>
</body>
내가 그렇게 document.ready 함수에서 두 번째 클릭 기능을 때 : 나는 다음과 같은 HTML 코드를 사용하는 경우 경고 및 숨기기 애니메이션을 모두 표시하도록하는 링크를 클릭
코드가 아래처럼 보이면 팝업이 나타나고 텍스트는 사라지지만 숨기기 애니메이션이 발생하지 않습니다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery demo</title>
<style>
a.test { font-weight: bold; }
</style>
</head>
<body>
<a href="http://jquery.com/">jQuery</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("a").click(function(event){
alert("As you can see, the link no longer took you to jquery.com");
event.preventDefault();
});
});
$("a").click(function(event){
event.preventDefault();
$(this).hide("slow");
});
</script>
</body>
</html>
왜 숨기기 애니메이션이 첫 번째 예만 표시되고 두 번째 표시가 아닌지 설명 할 수 있습니까?
DOM이 무엇인지, 핸들러 바인딩이 어떻게 작동하는지 더 자세히 살펴 보겠습니다. –