fix load fonts through css

attempt to cache font files and load after dom init
resulted in a visible jitter when fonts transitioned.
This commit is contained in:
Berkeley Martinez
2015-09-21 12:16:10 -07:00
parent 13d79f8a4f
commit 39fdd637d5
2 changed files with 1 additions and 26 deletions

View File

@@ -4,32 +4,6 @@ $(document).ready(function() {
challengeName :
'Untitled';
// pre-cache fonts
var lightDef = $.ajax({
url: '/fonts/Lato-Light.ttf',
beforeSend: function(xhr) {
xhr.overrideMimeType('application/octet-stream');
}
});
var regularDef = $.ajax({
url: '/fonts/Lato-Regular.ttf',
beforeSend: function(xhr) {
xhr.overrideMimeType('application/octet-stream');
}
});
// now add link to css
$.when(lightDef, regularDef).then(function() {
$('<link />')
.attr({
type: 'text/css',
rel: 'stylesheet',
href: '/css/lato.css'
})
.appendTo('head');
});
if (challengeName) {
ga('send', 'event', 'Challenge', 'load', challengeName);
}