Alert box


Visit premium theme zone


join telegram Channel for updates


How to lazyload fontawesome cdn

How to Lazyload Font Awesome Icons Without Compromising Your Page Speed

Fontawesome lazyload script

Are you using Font Awesome icons on your website but worried about how it affects your page speed? The good news is, you can now lazyload Font Awesome icons without any impact on your website's performance.

Steps to implement lazyload fontawesome cdn  in you website 

Here's how to implement a lazyload Font Awesome script that can help you improve your website's speed without compromising its design.

Step 1: Add the Lazyload Font Awesome Script

First, you need to add the lazyload Font Awesome script to your website. You can do this by copying and pasting the following code into your website's HTML file:

document.addEventListener(&quot;DOMContentLoaded&quot;, function() {
  var lazyloadStyle = function() {
    var style = document.createElement(&#39;link&#39;);
    style.href = &#39;;;
    style.rel = &#39;stylesheet&#39;;

  var lazyload = function() {
    if (window.pageYOffset &gt; 10) { // change the value of 100 to determine when to load the style sheet
      window.removeEventListener(&#39;scroll&#39;, lazyload);

  window.addEventListener(&#39;scroll&#39;, lazyload);


This script will load the Font Awesome icons only when the user scrolls down to a certain point on your website. This ensures that the icons are not loaded unnecessarily, improving your website's speed.

Step 2: Customize the Lazyload Point

The default value for the lazyload point in the script is set to 10, which means that the Font Awesome icons will be loaded when the user scrolls down 10 pixels. You can change this value to suit your needs.

For example, if you want the icons to be loaded when the user scrolls down 200 pixels, you can change the line of code that says "if (window.pageYOffset > 10)" to "if (window.pageYOffset > 200)".

Step 3: Test Your Website's pageSpeed

After implementing the lazyload Font Awesome script, it's important to test your website's speed to see if there's any improvement. You can use tools like Google's PageSpeed Insights to check your website's performance.

If you're still experiencing speed issues, you can try other optimization techniques like compressing images and minifying CSS and JavaScript files, but the fontawesome never give any Pagespeed error.

To use FontAwesome SVG icons, you can follow these steps:

1. Go to the FontAwesome website ( and sign up for a free account.

2. Once you've signed up, you can browse the library of icons and select the ones you want to use.

3. Download the icons in SVG format.

4. Add the SVG code to your HTML or CSS file where you want the icon to appear. You can copy and paste the code directly from the downloaded file, or you can use the FontAwesome icon library to generate the code for you.

5. Customize the size and color of the icon using CSS. You can use the `height` and `width` properties to adjust the size of the icon, and the `color` property to change its color.

Here's an example of how to use a FontAwesome SVG icon: 

    <p>follow me on Twitter 😁<i class="fab fa-twitter"></i> profile</p>

You need to add only RED COLOUR text to show a svg icon 


lazyload fontawsome,fontawesome,fontawesome code,fontawesome icons,lazyload,adding fontawesome to html,fontawesome cheatsheet,fontawesome install angular,lazyload js,fontawesome icons css code,lazyload image,react lazyload,lazyload is not a function,lazyload jquery,lazyload blogger,lazyload library,lazyload javascript,where to get fontawesome icons css code,lazyload youtube video,how to fix bug lazyload is not a function


Lazyloading Font Awesome icons can help improve your website's speed without compromising its design. By adding a simple script to your website, you can ensure that the icons are loaded only when necessary, reducing the load on your server and improving the user experience.

Last word

In this post we will provided information about How to lazyload fontawesome cdn, If you enjoy this post, kindly share it with your friends. For any queries, feel free to join our Telegram channel, where we share exclusive and informative content. Many valuable tips are exclusively available on our Telegram channel. Stay updated with your favorite source, DK Technozone.

Next Post Previous Post
  • vaggelis
    vaggelis 15 January 2024 at 19:09

    Well done, I was looking for a solution to this problem and couldn't find it anywhere. It works flawlessly.


Add Comment
comment url