views:

53

answers:

1

I have basic DOM menu that has sprite background images for the first level of "LI"s. It works just fine, but I guess there is some problem and instead of switching the image right away on hover it goes blank and after about a second the hover image "appears" (shifts).

That happens only on first hovering. After that it's smooth like it's supposed to be. Refresh the page and there it is again... Frustrating... Here is a link to check it out: http://goo.gl/6FAM

The problem exist on Firefox v3.6.3. Chrome 5.0.375 and IE 8.0.7600 don't have this issue.

Any ideas?

+1  A: 

It's because the hover background image is not loaded until you pass the mouse on the button.

An easy solution is to use CSS sprites, so you will only have 1 image to deal with.

nico
+1 for CSS sprites.
Shawn Steward
Well, basically that is what I am doing... there is only one image per LI element that contains both "background image" and "hover background image" - like this: http://goo.gl/oAwt
@user351342: hmmm... bizarre... Try this: in the CSS, instead of setting `background` for the `:hover` state, just set `background-position`, as the image name etc are all the same. So just put `background-position:-150px 0px`. With that it seems to load immediatly in FF.
nico