[Webdev] hiding images in divs

Kae Verens kverens at contactjuggling.org
Wed Jan 29 07:51:16 GMT 2003


Fergal J Byrne wrote:
> At 17:17 28/01/2003 +0000, you wrote:
> 
>> on a site that's being developed, to increase the perceived speed of 
>> searching through the database,
>> we've an image inside a span that we display before starting the 
>> search with:
> 
> 
> function hideContent(id) {
>     var obj = document.getElementById(id);
>     if (obj) {
>       if (obj.style) {
>         whichEl = obj.style
>       } else {
>         whichEl = obj
>       };
>       whichEl.display = 'none';
>     }
> }
> 
> Hide it by calling hideContent('txtShowHide')

I read that IE won't bother loading the image if it's display is set to 
none, so it may be better to simply turn off it's visibility 
("whichEl.visibility='hidden';").

Obviously, the layer should be positioned un-relatively so it doesn't 
screw up the rest of the layers on the screen.

Or better still - simply load the image, and position it off-screen.

-- 
Kae Verens               _______\_   webworks.ie
work: www.webworks.ie       _____\\__   webhosts
play: www.contactjuggling.org  ___\\\___  design
kae:  kverens.contactjuggling.org _\\\\____ code




More information about the Webdev mailing list