In one of My Layout there are some large images (come from XML) which shown when I mouse hover on some some of the link, but when the Page loads and when i rollover It takes time to Load that Image.
Note: there are fix 5 images (not dynamic)
I dont want to use JavaScript to Preload Images any Solutions?
I am Not Using Hover menu or something like that, but this Images are Product Images and the links are Text link Got my Point??
Reference your images in invisible img tags. while page loading they will downloaded too.
If preloading images is what you seek, then performance is what you want. I doubt blocking up the page while the resources load is what you want. SO, just place some prefetching links at the end of the body and add the bogus media to them to make them appear unimportant (so that they get loaded after everything else). Then, add the onload tag to those links, and in that onload will be the code that sets the source of the actual resource in your page. For example, this could even be used in conjunction with dynamic iframes.
Before:
After:
Notice how the first one (before) freezes up the page and blinks in a quite ugly manner while the second one (after) with the content preloaded doesn't freeze up the page or blink, rather it appears and disappears seamlessly instantly.
From http://snipplr.com/view/2122/css-image-preloader
A technique I didn't see mentioned here yet, which works great if you don't need to worry about IE6 & 7, is to use the
:after
pseudo-selector to add your images ascontent
to an element on the page. Code below lifted from this article:The only downside I can see to this compared to using JavaScript to preload the images is that there is no easy way to release them from memory.
As I'm not sure if hidden images are loaded, you'll probably want to use image sprites. Then the entire image is loaded before anything is displayed. You can even put all of your menu items in one image and therefore save a lot of HTTP requests.
HTML5 has a new way to do this, by
link prefetching
.Just add many
link
tags as you need in your HTML and you are good to go. Of course, older browsers will not load the content this way.UPDATE
If your server is served with HTTP2, you can also add a
Link
header in your response an make use of HTTP2 Server Push.