:hover
Craft
The brilliant Peter Nederlof has found a JScript hack to enable CSS :hover
behaviour on arbitrary elements in IE/Win.
Since I’m generally in favour of crufty hacks for crufty browsers, I’ve implemented his solution here at Musings. It took a bit of rejiggering of my CSS code to avoid the use of child selectors (>
), which IE still does not understand. With a bit of IE DOM manipulation,
window.onload = function(){ if (navigator.appName == "Microsoft Internet Explorer") { document.body.style.behavior = 'url(\"/csshover.htc\")'; } };
I can even do it with a CSS stylesheet that still validates.
In plain English, that means that my sidebar now works in IE/Win, and the user-experience now more closely approximates that of a Standards-Compliant browser. Let me know if you find any problems. I don’t promise to fix them, but you never know …
[ Tip 'o the hat to Anne van Kesteren.]
Posted by distler at January 4, 2004 4:03 PM