PDA

View Full Version : Dreamweaver rollover buttons


Yinny
09-22-2005, 10:52 AM
I have created eight rollover buttons in Fireworks to be inserted by Dreamweaver MX 2004. On my machine they work perfectly. Once the site is uploaded the buttons seem to keep reloading when you hover over them. Even when you click each button to go to a new page it takes several seconds to load 7/8kb pages and then they still need reloading. Any ideas?

davidj
09-22-2005, 11:07 AM
do you have a pre-loader script in your page?


img1 = new Image();
img2 = new Image();
img1.src = "imageName1.gif";
img2.src = "imageName2.gif"

dreamweaver has its own javascript behaviour which you can use

<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>

<body onload="MM_preloadImages('button-activity.gif','button-activity.gif')">

there are a number of ways of doing this

domedia
09-22-2005, 01:50 PM
I never liked DW's preloading script, so I find a way of including the mousover images as 1x1 pixel images on the page, so they're already in cache when the mouseover action is triggered.

davidj
09-22-2005, 01:54 PM
thats a good tip domedia

never thought of that before

Yinny
09-22-2005, 08:16 PM
Many thanks for the answers so far. Dreamweaver does indeed have its own preloader script which seems fine to me. A bigger concern is that I have two hosts, the one in questions has the 'reload' problem, the other host works fine??? Does this suggest a dodgy host? Should I change?