-
-
Save anodpixels/1927858601fc1b0ec0f7014be1704a01 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Google Fonts Preview</title> | |
<style> | |
#preview { | |
margin: 0 auto; | |
text-align: center; | |
width: 80%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="preview"></div> | |
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> | |
<script> | |
$(function() { | |
$.getJSON('https://raw.githubusercontent.com/jonathantneal/google-fonts-complete/master/google-fonts.json', function(fonts) { | |
$.each(fonts, function(k, v) { | |
//if (v.category!=='sans-serif') return; //filter only sans-serif fonts. replace with your filter condition(s) | |
var css = `@import url('https://fonts.googleapis.com/css?family=${k}');`; | |
$('<style/>').append(css).appendTo(document.head); | |
$(`<h1 style="font-family: '${k}'"/>`).text(`${k}: The quick brown Fox goes to Disney`).appendTo($('#preview')); | |
}); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment