GIDForums  

Go Back   GIDForums > Webmaster Forums > Web Design Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Feb-2007, 15:58
Blake's Avatar
Blake Blake is offline
Member
 
Join Date: Nov 2005
Posts: 255
Blake is a jewel in the roughBlake is a jewel in the rough

Preloading background image in display: none objects


I have the following in the stylesheet for my website:

CSS Code:
#projects_menu
{
	position: absolute;
	left: 98px;
	top: 161px;
	z-index: 1;
	width: 102px;
	height: 48px;
	font-size: 11px;
	overflow: hidden;
	border-bottom: 1px solid #165117;
	display: none;
	background: url("dropdownbg.gif");
}

My question is, will that background image be preloaded, so that it appears instantly when I make the object visible, or do I need to use some javascript to preload it?

If I do need to use javascript to preload it, is this all I need to do?

Code:
var dropdownbg = new Image(102, 59); dropdownbg.src = "dropdownbg.gif";
__________________
www.blake-foster.com
  #2  
Old 24-Feb-2007, 10:48
Corey Bryant Corey Bryant is offline
Member
 
Join Date: Oct 2003
Location: Castle Rock, CO
Posts: 216
Corey Bryant will become famous soon enough

Re: Preloading background image in display: none objects


It should load since it is in the CSS - whether or not it is displayed. There are a number of people that use something like this to pre-load some images instead of JavaScript.
  #3  
Old 01-Mar-2007, 02:45
hollis3162 hollis3162 is offline
New Member
 
Join Date: Mar 2007
Posts: 7
hollis3162 is on a distinguished road

Re: Preloading background image in display: none objects


Be careful when you do this if you use a lot of a lot of background images and you've only got one style sheet that's used across the entirety of your site. The first page a visitor arrives at will then load up every image.
 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create or display an image Unit1 C Programming Language 1 27-Sep-2006 03:18
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 15:46
lining seamless background up with image in dreamweaver? (pls hlp) sanspolanco Web Design Forum 2 24-Aug-2005 21:17
GIM gidedit - a fltk fluid resize project cable_guy_67 FLTK Forum 2 01-Jun-2005 16:00
Checking source codes of image, audio and video files onauc C Programming Language 5 26-Feb-2005 22:47

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:52.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.