Advertisement
iamdangavin

Lazy

Aug 24th, 2012
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.49 KB | None | 0 0
  1. /* Loads and fades in image */
  2.  
  3. function loadImage(image, callback) {
  4.     if (typeof callback == 'undefined') { callback = function(){}; }
  5.  
  6.     if (image.attr("src") == "images/core/transparent.gif") {
  7.    
  8.         image.animate({opacity:0}, 50, function() {
  9.             image.bind('load', function(){
  10.                             image.animate({opacity:1}, 1000).css({height:'auto'});
  11.                             callback();
  12.             });
  13.             image.attr("src", image.attr("data-original"));
  14.         });
  15.  
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement