Categories
JavaScript Answers

How to dynamically load google fonts after page has loaded?

Spread the love

Sometimes, we want to dynamically load google fonts after page has loaded.

In this article, we’ll look at how to dynamically load google fonts after page has loaded.

How to dynamically load google fonts after page has loaded?

To dynamically load google fonts after page has loaded, we can add the script tag for Google web font.

Then we write:

WebFont.load({
  google: {
    families: ['Droid Sans', 'Droid Serif']
  }
});

We call Webfont.load with an object to specify the fonts to load.

Conclusion

To dynamically load google fonts after page has loaded, we can add the script tag for Google web font.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *