Forum Moderators: not2easy
Was thinking that those who don't like using (or can't use) the all encompassing - whatever:hover behaviour file [xs4all.nl] - it perhaps still offers a "keep it in the CSS" solution.
I like it for quick testing but might use it more as it can go in the "legacy" IE file or in the main css file via a legacy hack.
Downside over the behaviour file is that you need to use extra class name distinctions.rules in the CSS like Suckerfish
Upside over Suckerfish is that you can easily incorporate more than one menu per page.
* html li {
behavior: expression(
this.onmouseover = new Function("this.className += ' hover'"),
this.onmouseout = new Function("this.className = this.className.replace(' hover','')"),
this.style.behavior = null
);
}your css rule might look something like this:
ul#nav li:hover, ul#nav [blue]li.hover[/blue] {property: value;}
the code above will apply the hover behaviour to all <li>'s in the site, or you can narrow it down to just your required menus using the usual more specific selector rules. e.g.
* html #nav1 li, * html #nav2 li {
behavior:expression(...);
} The * html is also optional and will apply it only to IE6 and below which is all that needs it - or you could drop that part and simply put it in a Conditional Comment.
As far as I can see, you don't have to use "behavior" as the property but it seems fair to me to use an IE proprietary property for an IE proprietary Dynamic Expression?
It might need hiding from IE/Mac, I don't know, if so that would be the downside to putting it in the main CSS file with the hack - but a Conditional Comment would also take care of that..
What do you all think any other downsides/upsides pros/cons, thoughts appreciated
Suzy
[edit] sp: note to self - I mustn't spell 'behavior' as 'behaviour' in code :o [/edit]
[edited by: SuzyUK at 11:08 am (utc) on Mar. 15, 2007]
On the other hand, I actually almost never use the HTC method, because for some reason I don't like it. Suckerfish seems cleaner. But I hadn't thought about the case where you need to apply it more than once.