Webmaster Forum
Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum > Web Design and Website Development > Programming > CSS Forums
Register FAQ Members List Downloads Calendar Search Today's Posts Mark Forums Read Webmaster Resources Webmaster Blogs

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-11-2007, 09:26 PM
SkinnerW's Avatar
Senior Member
 
Join Date: Jun 2007
Posts: 1,353
iTrader: 0 / 0%
SkinnerW is just really niceSkinnerW is just really niceSkinnerW is just really niceSkinnerW is just really niceSkinnerW is just really nice
Send a message via Yahoo to SkinnerW
Post Preloading roll-over images with CSS

Hi everyone,

Have you ever noticed on some websites when you hover mouse over navigation elements it blinks for a second and after short delay it changes background image? I have been seen this a lot lately...

The problem is that some time ago most of roll-over elements were controlled by javascript which used "onLoad" command but now more and more webmasters using CSS to control roll-overs.
Background images for "hover" state are not loaded initially that is why you see this little delay - image start loading after you hover mouse over that element.

Here is a little simple trick to avoid this delay.

In the end of your page right before closing </body> tag insert code for your roll-over background image in the following format:
Quote:
<img src="exact_image_path/menu_hover_image.gif" class="preload" alt="" />
where: exact_image_path - is location of your images folder and menu_hover_image.gif - is the name of background image for "hover" state of your roll-over element.

Now add this line to your CSS file:
Quote:
img.preload
{
display: none;
}
That's it!

Now these "hover" background images will load in the background while page is accessed first time and will be ready to display without delay.

The images will be pre-loading in the background so it will not affect your page loading time.
Same way you can pre-load any other images you want to have ready when particular page is accessed...

I hope you find this little tutorial helpful and I will be posting more tutorials on my blog shortly...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
  #2 (permalink)  
Old 11-02-2007, 12:28 AM
Contributor
 
Join Date: Jun 2007
Posts: 92
iTrader: 0 / 0%
Geoserv is on a distinguished road
Default

Good post,

Thanks
Geoserv.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
  #3 (permalink)  
Old 11-02-2007, 02:57 AM
Scripter's Avatar
UK WW Moderator
 
Join Date: Oct 2007
Posts: 253
iTrader: 0 / 0%
Scripter will become famous soon enough
Send a message via MSN to Scripter Send a message via Yahoo to Scripter
Default

Ah indeed.
Thanx for the input skinner
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
  #4 (permalink)  
Old 01-09-2008, 08:48 PM
Distinguished Member
 
Join Date: Jan 2008
Posts: 163
iTrader: 0 / 0%
smeagain is on a distinguished road
Default

Very neat, I like that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 11:32 PM
BenjArriola's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Manila and San Diego
Posts: 134
iTrader: 0 / 0%
BenjArriola is on a distinguished road
Send a message via ICQ to BenjArriola Send a message via AIM to BenjArriola Send a message via MSN to BenjArriola Send a message via Yahoo to BenjArriola Send a message via Skype™ to BenjArriola
Default

Excellent simple workaround! Although I don't use much image rollovers in the way I used to do it and I use CSS Spritenavs and also Suckerfish Dropdowns, I see this technique still useful in Lightbox JS galleries where you can preload the larger image so when the thumbnail is clicked, the larger one will appear instantly.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
Reply


Useful Resources & Sites
Search Engine Marketing Company
UK Web Hosting
Build One Way Links
 
 
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
your images darkstar_tfd General Webmaster Talk 21 05-05-2007 02:02 PM
Protect your Images! weitu General Webmaster Talk 2 11-20-2005 03:57 PM
Keywording Images Duke General Webmaster Talk 4 08-28-2005 01:16 PM
Images murali2611 iG Shop 0 01-05-2005 11:45 PM


All times are GMT. The time now is 04:04 PM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0