-2

When I execute the following command with the developer tools of firefox/chrome on a site with an animation it always return 0.

$(":animated").length

I want to find out how many animations are on the entire site.

Did I forgot anything?

I have have no code except this line. I only insert it in a chrome/firefox console.

gartenkralle
  • 646
  • 1
  • 11
  • 21

2 Answers2

1

Cause you must select first the container.

It works with (Chrome)

$("body :animated").length

I've try on https://api.jquery.com/animated-selector/

Chrome example

Alexis
  • 5,681
  • 1
  • 27
  • 44
1

Try the following:

  1. Open debugger in chrome.
  2. Click the sources tab.
  3. on the left side click the Snippets Tab
  4. right click the empty white space and choose new
  5. name it "script.js"
  6. on the right under the script.js tab enter: console.log($(document).find(':animated').length);
  7. Hit Ctrl+S to save
  8. now right click the script.js file on the left and choose run

The console will output the number of animated elements on the document. enter image description here

Devnsyde
  • 1,297
  • 1
  • 13
  • 34