[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

OnMouseOver slow on Firefox 3.5 (seems to be downloading image every time)

Posted on 2009-07-01
4
Medium Priority
?
587 Views
Last Modified: 2013-12-07
I have a fairly simple image mouseover set up on a website.  

Everything was working fine but now that I've upgraded to firefox 3.5 the image change takes a long time.  

I'm pretty sure that firefox is downloading the image from the server every time you hover over the image. ( I can see "Transferring data from..." in the status bar)

Is there anything I might be able to add to my code to stop this or is it simply a problem with firefox 3.5?  (Firefox 3.0 and IE do not have any problems)

Thanks,
David
<script type="text/javascript" language="JavaScript">
 
CursorOverone = new Image();
CursorOverone.src = "images/box/1b.jpg";
CursorOffone = new Image();
CursorOffone.src = "images/box/1a.jpg";
function ImageRollOverone(direction) {
if(direction == 'over') { document.imageone.src = CursorOverone.src; }
else if(direction == 'off') { document.imageone.src = CursorOffone.src; }
}
CursorOvertwo = new Image();
CursorOvertwo.src = "images/box/2b.jpg";
CursorOfftwo = new Image();
CursorOfftwo.src = "images/box/2a.jpg";
function ImageRollOvertwo(direction) {
if(direction == 'over') { document.imagetwo.src = CursorOvertwo.src; }
else if(direction == 'off') { document.imagetwo.src = CursorOfftwo.src; }
}
CursorOverthree = new Image();
CursorOverthree.src = "images/box/3b.jpg";
CursorOffthree = new Image();
CursorOffthree.src = "images/box/3a.jpg";
function ImageRollOverthree(direction) {
if(direction == 'over') { document.imagethree.src = CursorOverthree.src; }
else if(direction == 'off') { document.imagethree.src = CursorOffthree.src; }
}
CursorOverfour = new Image();
CursorOverfour.src = "images/box/4b.jpg";
CursorOfffour = new Image();
CursorOfffour.src = "images/box/4a.jpg";
function ImageRollOverfour(direction) {
if(direction == 'over') { document.imagefour.src = CursorOverfour.src; }
else if(direction == 'off') { document.imagefour.src = CursorOfffour.src; }
}
CursorOverfive = new Image();
CursorOverfive.src = "images/box/5b.jpg";
CursorOfffive = new Image();
CursorOfffive.src = "images/box/5a.jpg";
function ImageRollOverfive(direction) {
if(direction == 'over') { document.imagefive.src = CursorOverfive.src; }
else if(direction == 'off') { document.imagefive.src = CursorOfffive.src; }
}
CursorOversix = new Image();
CursorOversix.src = "images/box/6b.jpg";
CursorOffsix = new Image();
CursorOffsix.src = "images/box/6a.jpg";
function ImageRollOversix(direction) {
if(direction == 'over') { document.imagesix.src = CursorOversix.src; }
else if(direction == 'off') { document.imagesix.src = CursorOffsix.src; }
}
//-->
</script>
 
 
 
<span onmouseover="ImageRollOverone('over')" onmouseout="ImageRollOverone('off')"><a href="tepco_employment.php"><img name="imageone" src="images/box/1a.jpg" alt="Employment"></a></span><span onmouseover="ImageRollOvertwo('over')" onmouseout="ImageRollOvertwo('off')"><a href="tepco_training.php"><img name="imagetwo" src="images/box/2a.jpg" alt="Training"></a></span><span onmouseover="ImageRollOverthree('over')" onmouseout="ImageRollOverthree('off')"><a href="tepco_implementation.php"><img name="imagethree" src="images/box/3a.jpg" alt="Implementation"></a></span><span onmouseover="ImageRollOverfour('over')" onmouseout="ImageRollOverfour('off')"><a href="tepco_consulting.php"><img name="imagefour" src="images/box/4a.jpg" alt="Consulting"></a></span><!--<span onmouseover="ImageRollOverfive('over')" onmouseout="ImageRollOverfive('off')"><img name="imagefive" src="images/box/5a.jpg"></span>--><span onmouseover="ImageRollOversix('over')" onmouseout="ImageRollOversix('off')"><a href="tepco_resources.php"><img name="imagesix" src="images/box/6a.jpg" alt="Resources"></a></span>

Open in new window

0
Comment
Question by:dtsmith1984
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 17

Accepted Solution

by:
selvol earned 2000 total points
ID: 24755228
TRy adding the images in a corner of the page as 1x1px in size.

That way they will preload.

Just try to hide the.

Should be easy.

Also check to see you are not  clearing "private date" everytime in FF.
It in options.

Sort of like IE. "EVERy time it visits a page"

Selvol
0
 
LVL 17

Expert Comment

by:selvol
ID: 24755271
Here is a rollover script I use.

Does not seem to give me problems

<td><img src="NORMAL.jpg" onMouseOver="this.src='OVER.jpg'" onMouseOut="this.src=NORMAL.jpg'" border=""  width="" height="" Alt=" "></td>


You can use the same code for each image....

SElvol
0
 

Author Comment

by:dtsmith1984
ID: 24755451
Well, after reloading the page a few times it seems to do the mouseover faster.  Might have just been a glitch.  

If it happens more I will probably try the preloading of the images.

0
 
LVL 17

Expert Comment

by:selvol
ID: 24755956
Yea that is pretty much the simplest Preloading image trick I know.

You might want to go ahead and impliment the Preload.
As others may have problems,
What it is. The browser does  not see the rollover until the hover,
the delay is the image downloading.
If it is on the page somewhere else it will be in the cache on your computer.

Also  you can hide images for the next page on the current page with the 1x1px.
So when the next page comes up it has little delay.


Try to put the preload load at the bottom of the page. So it does not slow down the page content load speed.

Selvol
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn how to dynamically set the form action using jQuery.
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question