/ Published in: jQuery
Very easy way to preload images which are needed later (e.g. when a hover is performed)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> $.preloadImages = function() { for(var i = 0; i<arguments.length; i++) { $("<img />").attr("src", arguments[i]); } } $(document).ready(function() { $.preloadImages("hoverimage1.jpg","hoverimage2.jpg"); }); </script>