.delay()
is used for items that are part of a queue
, like animations. A simple addClass
is not queued.
You could use setTimeout
.
var trans = $('.transparent').removeClass('transparent');
setTimeout(function() {
trans.addClass('not_transparent');
}, 2000);
As an alternative, you could add the non-queued item to the queue using .queue()
, though I think a setTimeout
would be better.
$('.transparent').removeClass('transparent').delay(2000).queue(function(nxt) {
$(this).addClass('not_transparent');
nxt();
});