Skip to content

Instantly share code, notes, and snippets.

@lucasmlessa
Forked from kosmiq/js_google_fonts_async_ieshim
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save lucasmlessa/907b8fc8fe8d32ee37d9 to your computer and use it in GitHub Desktop.

Select an option

Save lucasmlessa/907b8fc8fe8d32ee37d9 to your computer and use it in GitHub Desktop.
WebFontConfig = {
google: { families: [ \'Ek+Mukta:200,800:latin\' ] }
};
var cb = function() {
var wf = document.createElement(\'script\');
wf.src = \'//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js\';
wf.type = \'text/javascript\';
wf.async = \'true\';
var s = document.getElementsByTagName(\'script\')[0];
s.parentNode.insertBefore(wf, s);
};
// shim layer with setTimeout fallback. Thanks Paul Irish http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
//Remove the old raf var and set it with our SHIM instead.
//var raf = requestAnimationFrame || mozRequestAnimationFrame || webkitRequestAnimationFrame || msRequestAnimationFrame;
var raf = requestAnimFrame;
if(raf){
raf(cb);
}else{
window.addEventListener(\'load\', cb);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment