Forum Moderators: not2easy
Any suggestions?
code example:
#secondary li a{background:url(../images/navbullet.gif) right no-repeat;padding-right:25px;color:#ccc;}
#secondary li a:hover{background:url(../images/navbullet-over.gif) right no-repeat;border:none;color:#fff;}
The hover image has not been preloaded, so will flicker on hover.
The good way around this is to make your navbullet and navbullet-over one image then apply the following css:
#secondary li a{background:url(../images/navbullet.gif) top right no-repeat; padding-right:25px; color:#ccc;}
#secondary li a:hover{background:url(../images/navbullet-over.gif) bottom right no-repeat; border:none; color:#fff;}
Your normal list item will position the image at the top right, with the hover being at the bottom right. It can be a wee bit tricky to get the original and hover images positioned perfectly, but moving the hover image above/below 1px at a time in your graphics package should sort it out :)
At best, you'll see the mouse pointer briefly turn into an hourglass when you mouse over the link. At worst the background will momentarily disappear.
It's made worse by changing the 'check for new versions of stored pages' setting in IE to 'Every visit to the page' ... just the sort of thing a web developer does.
The only complete fix is to play with the server's cache control headers for your images. If you Google for 'Dean Edwards IE flicker' you can see an Apache fix, and there's a link on the article to a fix for IIS.
I daresay that you could put something together using PHP or similar to deliver the appropriate cache control headers if you didn't have access to your server config.
This way, when the preload script loads the image, the http headers that are sent with the image will tell the browser to use the cached version for whatever expiry time you have specified.
if you want flicker free rollover, I suggest that a google search for...
single image rollover
...might prove illuminating. ;)
birdrain
There *is* a CSS-based - javascript preloader free - way around this.
I have a tutorial on my website on how to do CSS image swaps with no flicker in IE. But I can't post the link, so I'll just copy it here :)
HTML<div class="nav">
<a href="#"><img src="image.gif" width="150" height="100" alt="" /></a>
</div>
CSSdiv.nav {
height: 187px;
width: 136px;
margin:0;
padding:0;
background-image:url("logo-red.gif");
}div.nav a, div.nav a:link, div.nav a:visited {
display:block;
}div.nav img {
width:100%;
height100%;
border:0;
}div.nav a:hover img {
visibility:hidden;
}
conditional comment for IE to fix flicker<!--[if lte IE 6]>
<style type=text/css">
div.nav {background-repeat:no-repeat;}
div.nav a:hover {visibility:visible;}
</style>
<![endif]-->
You also MUST be sure the "background-position" for IE is NOT set, otherwise, you'll get the flicker again.
Hope you can play with that and get yourself fixed :)
quote:-
The reason IE does this is because IE will load a background up every time it's viewed.
birdbrain
the OP wrote
quote:-
...it flickers and acts funny...
I have never seen either of those effects in IE, using the single image rollover.
So what are these other problems, to which you refer?
birdbrain
At best, you'll see the mouse pointer briefly turn into an hourglass when you mouse over the link. At worst the background will momentarily disappear.It's made worse by changing the 'check for new versions of stored pages' setting in IE to 'Every visit to the page' ... just the sort of thing a web developer does.
An hourglass when 'Every visit to the page' is checked.