Created
August 14, 2012 10:56
-
-
Save suhajdab/3348158 to your computer and use it in GitHub Desktop.
Email obfuscation by css ( http://jsfiddle.net/suhajdab/dZsVB/ )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is an obfuscated email address: <a class="obsfuscated" href="#">moc.elpmaxe@zyx</a>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.obsfuscated { | |
unicode-bidi:bidi-override; | |
direction: rtl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ( classname ) { | |
'use strict' | |
function onMouseover( e ) { | |
this.className = this.className.replace(classname,''); | |
this.removeEventListener('mouseover', onMouseover); | |
this.innerHTML = this.innerHTML.split('').reverse().join(''); | |
this.setAttribute('href','mailto:' + this.innerHTML); | |
} | |
var els = document.querySelectorAll('.' + classname); | |
for ( var i = 0, el; el = els[ i ]; i++ ) { | |
el.addEventListener('mouseover', onMouseover, false); | |
} | |
})('obsfuscated'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment