简体   繁体   中英

Does jQuery return true for :animated when the animation is a CSS transition?

Scenario:

  1. Trigger a CSS transition by changing an element's class via jQuery.

  2. While the CSS transition is occurring, run if( $(elem).is(':animated') ) {…}

Will that if return as true?

You could have try it yourself, but I was curious and tested it.

http://jsfiddle.net/udedV/

The answer is no.

Using :animated check if the element is currently in a queue.

CSS transition do not use queue,

if( $(elem).is(':animated') )

It will alway be false if it is being animated by CSS.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM