Created
March 16, 2022 10:20
-
-
Save victory-sokolov/fd17c5068e145ec68d61d97be5fef2dd to your computer and use it in GitHub Desktop.
Dynamically load font
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var junction_font = new FontFace('Junction Regular', 'url(fonts/junction-regular.woff)'); | |
junction_font.load().then(function(loaded_face) { | |
document.fonts.add(loaded_face); | |
document.body.style.fontFamily = '"Junction Regular", Arial'; | |
}).catch(function(error) { | |
// error occurred | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment