25
$(document).ready(function(){
    $("#info-text-container").click(function(){
        $("#info-text").delay(500).addClass("info-text-active");
    });   
});

This does not put an delay on it when it gets clicked. Which I want to accomplish. Why and is this hackable, possible to overcome? Thanks!

Ram
  • 143,282
  • 16
  • 168
  • 197
user2097217
  • 419
  • 1
  • 9
  • 17

2 Answers2

46

delay only works with animating methods, you can use setTimeout function:

$("#info-text-container").click(function(){
    setTimeout(function(){
       $("#info-text").addClass("info-text-active");
   }, 500);
});
Ram
  • 143,282
  • 16
  • 168
  • 197
41

Not quite like that, but like this for example:

$("#info-text").delay(500).queue(function(next) {
  $(this).addClass("info-text-active");
  next();
});
elclanrs
  • 92,861
  • 21
  • 134
  • 171