2
$('.class1').delay(3000).not(".class2").removeClass("pulse");

It will remove the class before delay!

how can I stop it and delay for 3s and then remove "pulse"?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • Delay delays the animation queue, thus things like fadeIn(), slideUp() or stuff, not removeClass or any other non-queued methods. – user3154108 Aug 02 '16 at 08:10

2 Answers2

3

delay() does not work for removeClass() as it does not operate on the queue. You could use setTimeout() instead:

setTimeout(function() {
    $('.class1:not(.class2)').removeClass('pulse');
}, 3000);
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
1

Use setTimeout() instead of the delay. That is a regular JS function:

setTimeout(function(){
    $('.class1').not(".class2").removeClass("pulse");
}, 3000);
Randy
  • 9,419
  • 5
  • 39
  • 56