Load external Google Fonts stylesheet with YepNope/Modernizr

我只是一个虾纸丫 提交于 2019-12-04 17:25:33

Make sure you are adding the css prefix file to your copy of yepnope. It works like a jQuery plugin.

You can get it at:

https://github.com/SlexAxton/yepnope.js/blob/master/prefixes/yepnope.css-prefix.js

Or, you can call Google Webfont API, such as:

Modernizr.load({
 load: 'http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js',
 complete: function () {

  WebFont.load({
   google: {
    families: ['Open+Sans:300,400,700']
   }
  });
 }
});

Ideally should also have use a no-js fallback to load the fonts from your server using a timed function or another, like:

if (!window.jQuery) {
 Modernizr.load('http://d.clickmetrics.cl/assets/js/scaffolding/jquery-1.9.0.min.js');
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!