animated selector 정보
jQuery animated selector본문
animated selector
설명 : 선택기를 실행할 때 애니메이션 진행 상태에있는 모든 요소를 선택하십시오.
jQuery ( ": animated")
참고 : 효과 모듈없이 사용자 정의 jQuery 빌드를 사용 하면 :animated선택기에서 오류가 발생합니다.
추가 참고 사항 :
:animatedCSS 사양의 일부가 아닌 jQuery 확장 이기 때문에 사용하는 쿼리 :animated는 기본 DOM querySelectorAll()메서드 에서 제공하는 성능 향상을 이용할 수 없습니다 . :animated요소를 선택 하는 데 사용할 때 최상의 성능을 얻으려면 먼저 순수한 CSS 선택기를 사용하여 요소를 선택한 다음를 사용하십시오 .filter(":animated").
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>animated demo</title>
<style>
div {
background: yellow;
border: 1px solid #AAA;
width: 80px;
height: 80px;
margin: 0 5px;
float: left;
}
div.colored {
background: green;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button id="run">Run</button>
<div></div>
<div id="mover"></div>
<div></div>
<script>
$( "#run" ).click(function() {
$( "div:animated" ).toggleClass( "colored" );
});
function animateIt() {
$( "#mover" ).slideToggle( "slow", animateIt );
}
animateIt();
</script>
</body>
</html>
0
댓글 0개