Skip to Menu
jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}

Usage Example

<script type="text/javascript">
// preload images first (can run before page is fully loaded)
$.preloadImages("over.png", "out.gif");
$(
	function()
	{
		// do something when page is ready
		$("a.foo img").hover(
			function()
			{
				this.src = "over.png";
			}
			,
			function()
			{
				this.src = "out.gif";
			}
		)
	}
)
</script>