justuptime.com - monitor your servers & websites

mouse over help

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
fifeclub's picture

He has: 675 posts

Joined: Feb 2001

Hello all. I tried adding mouse over graphic effects to my menu (which was previously static). Technically the code I used works properly but it seems PAINFULLY slow to me on my computer, both waiting for the mouseover image to appear and for the regular image to reappear.

First I was wondering if somebody else can confirm this drastic time delay? Secondly, can you tell me what I may be able to add to my code to fix/improve this effect? Or is the code I used garbage and I should use another technique althogether?

http://www.pstvalumni.com

Thanks!

Nip it in the bud!

Suzanne's picture

She has: 5,512 posts

Joined: Feb 2000

wow. the delay is visible on dsl as well. big flashes of white.

You're not preloading the mouseovers, you're preloading the images that load anyway...

Try this instead:

<script type="text/javascript">
image2 = new Image();
image2.src = "pstv-template_02b.jpg";
image4 = new Image();
image4.src = "pstv-template_04b.jpg";
image5 = new Image();
image5.src = "pstv-template_05b.jpg";
image6 = new Image();
image6.src = "pstv-template_06b.jpg";
image7 = new Image();
image7.src = "pstv-template_07b.jpg";
image8 = new Image();
image8.src = "pstv-template_08b.jpg";
image9 = new Image();
image9.src = "pstv-template_09b.jpg";
image10 = new Image();
image10.src = "pstv-template_10b.jpg";
</script>

'

taff's picture

They have: 956 posts

Joined: Jun 2001

Heh - yep, Suzanne's solution should fix it. Before you do, just for fun, run your mouse up and down the menu a few times quickly. If you do it enough, the server becomes overwhelmed tried to call up those 8 images over and over again and gets stuck at "8 images remaining" and the rollovers stop working completely.

.....

fifeclub's picture

He has: 675 posts

Joined: Feb 2001

Thanks for the help. I made the adjustment but it's just as slow. Should I give up on that scripe and lookfor a different method? Or is that pretty much the univerally standard way to do a preloaded mouseover?

Nip it in the bud!

Suzanne's picture

She has: 5,512 posts

Joined: Feb 2000

Ugh, sorry -- the problem is that you're preloading the images right now, but calling the wrong images!

You are preloading "pstv-template_##b.jpg" and calling "/images/pstv-template_##b.jpg" in the code -- make them the same set of images and you'll find they work better.