Hexagora Forum
Hexagora Forum
Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Dynamic HTML Editor
 Dynamic HTML Editor
 Javascript or css preloading of images?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Martin1
Super User

Netherlands
626 Posts

Posted - 26 Jan 2008 :  19:30:03  Show Profile  Reply with Quote
Which would be better? The javascript way of pre loading images or the css way.
<SCRIPT LANGUAGE="JavaScript">
<!-- hide from none JavaScript Browsers

Image1= new Image(175,50)
Image1.src = "image1.gif"

Image2 = new Image(25,30)
Image2.src = "image2.gif"

Image3 = new Image(125,80)
Image3.src = "image3.gif"

// End Hiding -->
</SCRIPT>

or css

<style type="text/css">
.hiddenPic {display:none;}
</style>

<img src="poodle-puppy-Clara.jpg"
alt="Clara at 8 weeks" title="Clara at 8 weeks"
height="350" width="350" class="hiddenPic">


<img src="poodle-puppy-Kenny.jpg"
alt="Kenny at 10 weeks" title="Kenny at 10 weeks"
height="350" width="350" class="hiddenPic">


<img src="poodle-puppy-Aiko.jpg"
alt="Aiko at 6 weeks" title="Aiko at 6 weeks"
height="350" width="350" class="hiddenPic">


Martin

jtarin
Super User

Russia
444 Posts

Posted - 28 Jan 2008 :  03:59:55  Show Profile  Visit jtarin's Homepage  Reply with Quote
Here's a link that gives some insight on the pro and cons as to both method, with a preference to CSS. Javascript...plenty of scripts available and fast. CSS....good for browsers that turn Javascript off.
http://www.ilovejackdaniels.com/css/preloading-images-with-css/

Porky
www.pacificwavetour.com

Edited by - jtarin on 28 Jan 2008 04:00:17
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Hexagora Forum © s.dav Go To Top Of Page
Snitz Forums 2000