Pre-loading Images: CSS Hack
Well, hackers get what they get and what this gets is a broken site in IE 7. Wah-wah. -ja
Now that I’m using CSS to control my image hover states (by setting the background image), I need a way to preload these “roll-over” images for so that the user doesn’t get a momentary blank the first time they mouse over a button.
Check this. Absolutely zero scripting. So easy it hurts.
Somewhere in the <body> of your page, you’re going to include this div:<div id=”preload”><img src=”the_same_img_path_that_you_are_using_in_your_CSS_code.jpg” width=”1” height=”1” /></div>
In your CSS code, this:div#preload { display: none; }
Voilà!
via Perishable Press