Forum Moderators: open

Message Too Old, No Replies

Page repeatedly reloads rollover graphics

         

Nealreal

5:26 pm on Jun 23, 2006 (gmt 0)

10+ Year Member



I created a site built in Dreamweaver and in a template.
The prob is the page graphics (the buttons and navigation and links on the side) reload each time I go to a new page.

I thought that if the browser downloads the images and rollovers once, that it shouldn't do it again. The browser seems to be re-downloaded all the images again each time I view another page within the template. It works fine in Firefox but in IE it keeps re-downloading as if each has been viewed for the first time.

I hate this. And I know my clients will see this as well. Is there a code that I can add to the page to tell the browser to download them once and stop re-downloading them each time I browse. Any help would be greatly appreciated.

I would need a simple to cut&paste to the page because I dont anything about Javascript or other programming languages.

[edited by: encyclo at 5:56 pm (utc) on June 23, 2006]
[edit reason] no links to personal sites please, see forum charter [/edit]

encyclo

1:16 am on Jun 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you are using rollover images, the best way is to use Javascript to preload the images as the page is loading, which ensures that the rollovers are immediate as the images are already held in the browser cache.

A simple image preload script would be something like this in the

head
section of your page:

<script type="text/javascript">
function imgpreload() {
var MyImg = new Image();
MyImg.src = "path/to/graphic.jpg";
}
</script>

With the following on the opening

body
tag:

<body onload="imgpreload()">

You can get more information about preloading scripts in our JavaScript and AJAX forum [webmasterworld.com].