I’m making menuitems like this. Is it possible to make the bullet image have rollover change when users hover the links using only css?
What I have now is that IE has a link only in the bullet where Firefox is linking the whole thing correctly, but none of the tested browsers change the bullet image…
I’ve gone through few tutos about css rollovers, but haven’t found anything suitable for my needs.
Any help is much appreciated.
EDIT: The menu items might be different in width, so I cant have the whole item background in one image and use backround-position. I have to be able to just change the bullet picture…
EDIT2: This is what I’m trying to achieve, if it’s not clear. Just without the javascript. Possible?
Sorry, but I can’t figure out how that would help. Though I have looked into Paul’s “Disjointed rollover effects”, and I think this might be the solution, but I find it hard to make it work…
Perhaps you can make the whole image a background image, then use a:hover to swap it for a different background image?
EDIT: Ahh, I see that’s what you’re trying to do (peeked at the code), but instead of having the background image on #menu_bullet try to use it on #menu_bullet a:link, #menu_bullet a:visited.
I think the way you have it, the hover image is underneath the regular image. You could try adding z-index: 2 to the hover image, but I’m not sure if z-index causes browser compatibility issues or not.
Setting the bullet background image to #menu_bullet a:link, etc. resulted that the bullet image was not shown at all?? also trying to change z-index did not help.
Works good in firefox, but not in IE.
Then I thinked about the thing, that setting the bgimage to #menu_bullet a:link did not show it at all, I thought that maybe the #menu_bullet a:hover was not showing up for the same reason… and as the #menu_bullet is allready an link element, I just tried setting the hover to #menu_bullet:hover and it worked!!
If you now look this page with Firefox or Opera, you see it working just perfectly. But with IE, the link is only in the bullet element… and not in the whole thing… So that’s no good. Any way to fix this?
bracka fracka suppadoodle sanna franna (down to just muttering under breath).
Can get it to work in either IE6 or FF1.5, but not both.
The way it is set up, the whole picture is essentially the link, so when you mouse over any part of the pic (except the text in IE dammit) you get the hover style. Lists are tough because often you want the bullet to change based around a behaviour related to the text next to it. Need them to be independant, but linked.
Anyway, long and short, I’m stumped man, sorry. Hopefully one of the gurus could help you out.
Hehe, I didn’t notice that IE actually has the whole thing as a link, but it just doesn’t render the hand as the cursor. So I just put cursor: pointer; to the container and now it works and looks just fine in IE too.
So click here, to see the end result. Using just one background image in the bullet and changing the background-position would be even better, I might try that next, but glad to have something working allready.
Any comment’s about the way it’s done? I don’t know how other browsers render it (or older browsers), but firefox, opera and ie works great.
And here’s the code for others to see as the page behind the link get’s removed after a while…
In FF1.5 the whole container is still a link, complete with the hand.
In IE6 the whole container is a link, but it’s just a pointer cursor, except over the text when I get just a text select cursor.
It’s a mystery why IE will let you do #menu_bullet:hover but not a li:hover
my brain is a little cooked, I don’t even wanna imagine yours.
I have the beginings of a really complex solution forming in my brain, but I’m going to give it some rest for now. From my experience complex solutions are never really needed, hopefully someone will offer some insight.
Yes, I had it like this also. But as I said, I just put “cursor: pointer;” to the container, and atleast my IE6 is showing the hand now for the whole item just like FF.
Could you have the old version still in cache? It should work for you too…
#menu_bullet is an link element, so I think it’s logical that #menu_bullet:hover is working. li:hover is a competely different thing then…
It’s a mystery why IE will let you do #menu_bullet:hover but not a li:hover
IE only understands hover on anchors whereas other browsers such as firefox will allow hover to work on other elements as well.
As a rule of thumb you should never swap an image on hover because it is too slow and the image is only loaded the first time you roll over the element and you will get a delay.
The easiest way to swap images is to put the over state into the background of the parent and then overlay it with the normal state in the anchor. On hover you just make the anchor background transparent and the image already preloaded underneath shows through without delay.
Ooh master, that’s some wicked sorcerery…! You’re the greatest! That saved me alot of time. I was going to do it by having the normal and hover state in one image and change the background position, but this works like a charm. I haven’t even noticed that transparent value of background.
Thanks alot!
EDIT: Almost forgot! Also many thanks to all others who helped! :tup:
I’m sorry, I noticed that too now… I did’nt get what you meant for me to try when you posted it, so I just overlooked it quickly… Thanks alot for the help!