수

animated selector

· 2017-08-04 (금) 19:08:04 · 2247

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>

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

개발자팁

5,403건

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

+
분류 제목 글쓴이 날짜 조회
PHP 17-05-05 조회 2,660
PHP 17-05-04 조회 2,723
PHP 17-05-04 조회 3,101
PHP 17-05-04 조회 2,593
node.js 17-04-30 조회 2,482
jQuery 17-04-14 조회 2,094
jQuery 17-04-14 조회 2,193
jQuery 17-04-14 조회 2,526
PHP 17-04-14 조회 2,598
PHP 17-04-14 조회 2,881
PHP 17-04-14 조회 2,816
jQuery 17-04-13 조회 1,882
jQuery 17-04-13 조회 1,851
jQuery 17-04-13 조회 2,382
PHP 17-04-11 조회 2,723
PHP 17-04-11 조회 2,242
PHP 17-04-11 조회 2,961
OS 17-04-11 조회 3,250
PHP 17-04-10 조회 2,391
PHP 17-04-10 조회 2,004
PHP 17-04-10 조회 2,437
PHP 17-04-05 조회 2,454
PHP 17-04-05 조회 2,862
PHP 17-04-05 조회 2,703
jQuery 17-04-05 조회 2,304
jQuery 17-04-05 조회 1,840
jQuery 17-04-05 조회 2,430
jQuery 17-04-04 조회 2,343
jQuery 17-04-04 조회 2,118
PHP 17-04-04 조회 3,074