1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

What is the way to manually insert a preloader in Divi-child homepage header?

Discussion in 'Free Divi Community Forum' started by Dan Cook, Oct 11, 2023.

  1. Dan Cook

    Dan Cook New Member

    header.php code https://zerobin.net/?ea6167f2af4d2e24#GTOJZ0rcpLojqhpnCc+cK4FlCRFNtv2HvAB+osySc8o=

    What is the way to manually insert a preloader in Divi-child homepage header?

    I found a preloader i like, but whether i insert the code below the body on header.php or with WP Smart prealoder with the custom html/css, it either displays too big, or misplaced. Tends to be around the secondary menu, (at the very top).

    The preloaders display fine on a test.html file.

    The loaders baked into WP Smart Preloader work fine.
    I tried other loader's html/css code on header.php, and the same issue happens!

    If i can't achieve what i want manually as i don't like plugins, does DP Preloader https://www.elegantthemes.com/marketplace/dp-preloader/
    from "Elegant Themes", work well with custom html/css?

    **PS: Please look at the header.php code in pastebin to confirm if the loader html/css is in the right place?**

    Preloader Code below.

    HTML:
    <!-- Start: Loading spinner 1 -->
    <!DOCTYPE html>
    <html lang="">
      <head>
        <meta charset="utf-8">
        <title></title>
         <link rel="stylesheet" href="style.css">
        <script src="script.js"></script>
      </head>
    
      <body>
        <header>
    
    <div class="dot-loader"></div>
    <div class="dot-loader"></div>
    <div class="dot-loader"></div>
    
    <style>
    .dot-loader{
        height: 20px;
        width: 20px;
        border-radius: 50%;
        background-color: #03A9F4;
        position: relative;
        -webkit-animation: 1.2s scaleDown ease-in-out infinite ;
        animation: 1.2s scaleDown ease-in-out infinite ;
    }
    
    .dot-loader:nth-child(2){
        margin: 0 15px;
        -webkit-animation: 1.2s scaleDown ease-in-out infinite .15555s;
        animation: 1.2s scaleDown ease-in-out infinite .15555s;
    }
    
    .dot-loader:nth-child(3){
        -webkit-animation: 1.2s scaleDown ease-in-out infinite .300000s;
        animation: 1.2s scaleDown ease-in-out infinite .300000s;
    }
    
    @-webkit-keyframes scaleDown{
        0%, 80%, 100%{
          -webkit-transform: scale(0);
                  transform: scale(0);
        }
        40%{
          -webkit-transform: scale(1);
                  transform: scale(1);
        }
    }
    
    @keyframes scaleDown{
        0%, 80%, 100%{
          -webkit-transform: scale(0);
                  transform: scale(0);
        }
        40%{
          -webkit-transform: scale(1);
                  transform: scale(1);
        }
    }
    
    </style>
     
    #1 Dan Cook, Oct 11, 2023
    Last edited: Oct 11, 2023
    1. PRO MEMBER PERKS Beautifully crafted custom colored 'Digital Marketing' Divi layout for all Pro members:View Demo
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

    From what I see from your code, it only has preloader icon added to your site. There's no fullscreen overlay to hide the content on load. There's also no script to fade out the preloader when finished loading.

    If you're looking for a full preloader solution without any plugins, you may check out Divi Block premade preloader design: https://diviblock.com/divi-preloader/
    **Do note that you will need to use the premade preloader design at Divi Theme Builder global header. Use it as the first section in the global header to prevent seeing any flashes when the page load. But if you were to use default Divi header, then you will need to replicate the design with Divi Theme Builder for your global header. This is because if you're using Divi Theme Builder global header, the default Divi header will be replaced / hidden.
    **No need for any child theme PHP customization.