Local Fallback for Google Web Fonts

后端 未结 3 666
無奈伤痛
無奈伤痛 2020-12-28 20:18

The HTML5 Boilerplate uses a script for loading a local copy of jQuery if, for whatever reason, the Google CDN version fails to load:



        
3条回答
  •  梦谈多话
    2020-12-28 21:04

    A client-side fallback calling a css file containing the call different fonts (here Tangerine font):

    (function test($){
        var $span = $('').appendTo('body'); // span test creation
        if ($span.css('fontFamily') !== 'Tangerine'){
            $('head').append(''); // fallback link
        }
        $span.remove(); // span test remove
    })(jQuery);
    

提交回复
热议问题