What is the best way to put a delay on the showing of a ajax-loader gif. When I click a button the loader gif shows and hides even if the time taken is a few hundred milli-secon
Here is a fun way to do it. Replace $loader.show() with this:
$loader.show()
$("#loader").data('timeout', window.setTimeout(function(){ $("#loader").show()}, 1000));
And your hide command with this:
window.clearTimeout($("#loader").hide().data('timeout'));