Skip to content

Pagepro/fontsLoader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FontsLoader

###Benefits

  • Displays text after html is loaded
  • Get rid of FOIT

Requirements

  1. jQuery
  2. FontFaceObserver

##Installation

###Step 1: Link plugins file

<script src="/js/fontfaceobserver.js"></script>
<script src="/js/fontsloader.js"></script>

###Step 2: Set up css styles

body {
    font-family: 'Arial';
}
.fonts-loaded body {
    font-family: 'Open Sans';
}
.fonts-loaded .special {
    font-family: 'Roboto'
}

###Step 3: Call function in javascript

$(document).ready(function(){
  $('html').fontLoader({
        fonts: {
            'Open Sans': [200, 400, 600, 700],
            'Roboto': [100, 300, 400]
        },
        fontLoadedClass: 'fonts-loaded'
    });
});

DOC for @pagepro users Presentation

##Configuration options

fonts Objects with font family names as key and array of weights as value

default: 'Arial': [400]
options: fonts

fontLoadedClass Fonts Loaded Class name

default: 'fonts-loaded'
options: class name

##Licenses

FontFaceObserver

Copyright 2014-2015 Bram Stein.

https://github.com/bramstein/fontfaceobserver

About

Helps to get rid of FOIT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published