animated selector

· 8년 전 · 1816

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>

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

개발자팁

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 8년 전 조회 1,793
jQuery 8년 전 조회 1,544
jQuery 8년 전 조회 2,212
jQuery 8년 전 조회 1,739
jQuery 8년 전 조회 2,063
jQuery 8년 전 조회 1,855
jQuery 8년 전 조회 2,083
jQuery 8년 전 조회 1,771
jQuery 8년 전 조회 1,555
jQuery 8년 전 조회 1,360
jQuery 8년 전 조회 1,789
jQuery 8년 전 조회 2,412
jQuery 8년 전 조회 1,425
jQuery 8년 전 조회 1,834
jQuery 8년 전 조회 1,817
jQuery 8년 전 조회 2,615
jQuery 8년 전 조회 2,110
jQuery 8년 전 조회 1,992
jQuery 8년 전 조회 1,968
jQuery 8년 전 조회 1,730
jQuery 8년 전 조회 1,147
jQuery 8년 전 조회 1,794
jQuery 8년 전 조회 2,541
jQuery 8년 전 조회 2,422
jQuery 8년 전 조회 1,806
PHP 8년 전 조회 3,136
jQuery 8년 전 조회 1,650
jQuery 8년 전 조회 1,827
PHP 8년 전 조회 2,043
PHP 8년 전 조회 2,178
🐛 버그신고