Browse - Programming Tips - How do I preload an image using jQuery?

Date: 2012jul4
Language: javaScript
Platform: web

Q.  How do I preload an image using jQuery?

A.  Create and use an Image object in your ready() function:

$(document).ready(function() { var myimg = new Image; myimg.src = 'images/myimg.jpg'; });