2013-09-23 69 views

回答

2

使用的setTimeout http://jsfiddle.net/bhlaird/hym6U/

$('img.change').click(function() { 
    var self = this; 
    $(self).attr('src', "http://placekitten.com/100/100"); 
    setTimeout(function() { 
     $(self).attr('src', "http://placekitten.com/g/100/100"); 
    }, 2000) 
}); 
3

你可以這樣做:

$('img.change').click(function(){ 
      $(this).attr('src','second.png'); 
      setTimeout("changeToOriginal", 2000); 
    }); 

    function changeToOriginal() { 
      $("img.change").attr('src','first.png'); 
    }