Skip to content

Instantly share code, notes, and snippets.

@irae
Created August 31, 2010 17:52
Show Gist options
  • Save irae/559425 to your computer and use it in GitHub Desktop.
Save irae/559425 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
(function(){
// Fix IE problem with many span inside an <a> and fix hovering
if(document.body.attachEvent){
function findLink(elm) {
if(elm.nodeName.toLowerCase() == "a") {
return elm;
} else {
return findLink(elm.parentNode);
}
}
function blocoTopsEnter() {
var a = findLink(window.event.srcElement);
a.className += ' over';
};
function blocoTopsLeave() {
var a = findLink(window.event.srcElement);
a.className = a.className.replace(/ ?over/g,'');
};
function blocoTopsClick() {
var a = findLink(window.event.srcElement);
document.location.href = a.href;
};
var as = document.getElementById('novaColDireita').getElementsByTagName('a');
for(var i=0;i<as.length;i++) {
as[i].attachEvent("onmouseenter", blocoTopsEnter);
as[i].attachEvent("onmouseleave", blocoTopsLeave);
as[i].attachEvent("onclick", blocoTopsClick);
}
}
})()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment