I have some jquery and am trying to apply a delay to it but can’t seem to get it to work.
The current jquery is as follows…
image.css({"visibility" : "hidden"}).removeClass("image-background");
and I have tried ammending this according to the jquery website (http://api.jquery.com/delay/) to apply the delay…
image.delay(800).css({"visibility" : "hidden"}).removeClass("image-background");
but this doesn’t seem to make any difference.
Can anyone see a problem with this? Or how I could fix the problem?
Thanks in advance.
The
delay()function only applies to actions queued on the element. Most commonly, but not always, these are actions created by theanimate()method. In this case, usesetTimeoutto run some code after a specified interval.Try this: