Created
November 21, 2012 00:06
-
-
Save JoshuaJones/4122151 to your computer and use it in GitHub Desktop.
Font Icon Added with jQuery's Help
This file contains 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Font Icon Added with jQuery</title> | |
<style> | |
[data-icon] i { | |
font: normal 1.65em 'ModernPictogramsNormal'; | |
padding-right: 5px; | |
speak: none; | |
-webkit-font-smoothing: antialiased; | |
} | |
</style> | |
<script src="jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$('[data-icon]').each(function() { | |
var target = $(this), | |
icon = $('<i aria-hidden="true">' + target.attr('data-icon') + '</i>'); | |
target.prepend(icon); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h2 data-icon="A">Camera</h2> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment