Skip to content

Instantly share code, notes, and snippets.

@JoshuaJones
Created November 21, 2012 00:06
Show Gist options
  • Save JoshuaJones/4122151 to your computer and use it in GitHub Desktop.
Save JoshuaJones/4122151 to your computer and use it in GitHub Desktop.
Font Icon Added with jQuery's Help
<!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