title: jQuery - show loading image only if ajax call takes more than one second?
body: <p>Is it possible to show the "Loading.." animation only if the ajax call takes more than say, one second? Some of my ajax calls are pretty fast but I still see the loading icon for a fraction of a second before it disappears. May be it's just me, but I find it distracting. I don't want to remove it altogether though. Any suggestions? Here's my code -</p>
  
  <pre><code>    $('#loading').hide()
      .ajaxStart(function() {
          $(this).show();
      })
      .ajaxStop(function() {
          $(this).hide();
      });
  
  &lt;div id="loading"&gt;
      &lt;img alt="Loading, please wait.." src="/content/images/spinner.gif" /&gt;
  &lt;/div&gt;
  </code></pre>