Good day, google - did not find information:

1) Is it possible to select, let's say, all <img> with one (!) Request in jQuery, except for those with a class, for example, .noplay

2) Is it possible to $('.myplay_divs').each(function() { //mycode }); perform with a delay of say 500 for each item? and in general, is it really possible to delay (pause) a certain action (animation) jQuery without stopping others?

Thanks for attention!

    2 answers 2

    1. $('img').not('.noplay')
    2. can do:

    $('.myplay_divs').each(function (index, value) { setTimeout(function () { // your code }, 500 * index); });

      one)

       $('img:not(.noplay)') 

      or

       $('input').not('.noplay') 

      2) smoke about setTimeout

      • one
        And the first method works faster, especially in modern browsers. - Gena Tsarinny
      • well, it follows from the logic of building these selectors - in the second, all img are selected first, and only then the not filter is applied to them, and in the first the filter can be applied initially. Although, I didn’t climb into the jQuery guts, I can’t say for sure, maybe some kind of optimization is used there - DreamChild
      • Just because Since the selector is valid from a CSS point of view, browsers (of course, if supported) can use querySelectorAll and gain in performance. If interested, here is a performance test: jsperf.com/jquery-css3-not-vs-not - Gena Tsarinny
      • @Genson, thank you, curious - DreamChild