jQuery Preload Images


/ Published in: jQuery
Save to your folder(s)

This script preloads images in your document or lets your to preload images by their url and insert or append them in your DOM tree later.


Copy this code and paste it in your HTML
  1. // Insert preloaded image after it finishes loading
  2. $('<img />')
  3. .attr('src', 'imageURL.jpg')
  4. .load(function(){
  5. $('.profile').append( $(this) );
  6. // Your other custom code
  7. });

URL: http://jquery-howto.blogspot.com/2009/02/preload-images-with-jquery.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.