Return to Snippet

Revision: 11157
at January 26, 2009 17:01 by mihael


Initial Code
<!--[if lte IE 6]> 
<script type="text/javascript">
sfHover = function() {
	var sfEls = document.getElementById("mainNav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
</script>
<![endif]-->

Initial URL

                                

Initial Description
This is the javascript code that enables you to create hover effects also in IE6. It's clean, it's light, it's super! :)

Apply that code to your document (eg. in <head></head>) and in css add like this:

ul li:hover,  ul li.shover {  your css styles }

Explain: IE6 will on mouse over element add .shover to that element.

Initial Title
IE6 - :hover fix (shover) - simplified

Initial Tags
dropdown, ie6

Initial Language
JavaScript