/ Published in: JavaScript
assigns/removes the class 'over' to elements on hover since IE does not attach :hover to any element but A
Expand |
Embed | Plain Text
setIEHoverState : function (id,tagname) { //fix the :hover pseudoclass in IE6- el = document.getElementById(id); if(el) { tn = el.getElementsByTagName(tagname); for(i=0;i<tn.length;i++){ tn[i].onmouseover= function(){ this.className ? this.className += ' over' : this.className = 'over'; } tn[i].onmouseout = function(){ this.className = this.className.match(/ over/) ? this.className.replace(/ over/,'') : this.className.replace(/^over/,''); } } } }
You need to login to post a comment.
