How to build a JavaScript page loading animation

How to build a JavaScript page loading animation


To better understand what we’re going to build, check out the demo page. Be sure to click on the menu links to repeat the page loading JavaScript animation.

As both JS animations have similarities, I’ll borrow some content sections from the previous tutorial. This will help keep each tutorial detailed and independent. 

Web page loading animation JavaScript demo

For this tutorial our web page loading animation demo won’t live on CodePen. As we need different pages to showcase the JS page loading, I decided that it’s better to host it on GitHub. Here’s the project structure for the JS page loading:

1
panels-animation/
2
├── about.html
3
├── contact.html
4
├── index.html
5
├── main.css
6
└── main.js

Before we continue, it’s worth noting that the inspiration for this page loading animation JavaScript demo is taken from the rather lovely Nine Orchard’s website.

screenshot of the 9 orchards websitescreenshot of the 9 orchards websitescreenshot of the 9 orchards website

1. Begin with the page markup

Let’s describe the markup for the index.html page. This will be similar to the other pages.

Inside it, we’ll place:

  • A typical page header
  • The panels that will be responsible for splitting the screen into seven equal parts.
  • The main element where the page’s main content will live.

Additionally, we’ll import:

With all the above in mind, here’s the associated markup for the animation with JavaScript:

1

2
 lang="en">
3
  
4
     charset="utf-8">
5
     name="viewport" content="width=device-width, initial-scale=1">
6
     rel="preconnect" href="https://fonts.gstatic.com">
7
     rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap">
8
     rel="stylesheet" href="main.css">
9
    </span>Simple JavaScript Page Loading Animation<span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>  
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"><header> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"page-header"</span><span style="color: #f4bf75">></span>
</header></span></pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><nav/></span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #f4bf75"><li/></span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>            <span style="color: #f4bf75"><a> <span style="color: #6a9fb5">href=</span><span style="color: #90a959">"index.html"</span><span style="color: #f4bf75">></span>Home<span style="color: #f4bf75"/></a></span>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>          <span style="color: #949494"><!-- more list items --></span>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre>    
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/></pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 3"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 2"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-27" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>27</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 1"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-28" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>28</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 0"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-29" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>29</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 1"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-30" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>30</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 2"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-31" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>31</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"><li> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"panel"</span> <span style="color: #6a9fb5">style=</span><span style="color: #90a959">"--index: 3"</span><span style="color: #f4bf75">></span></li></span>
</pre>
</td>
</tr>
<tr id="line-32" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>32</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-33" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>33</pre>
</td>
<td class="rouge-code">
<pre>    
</pre>
</td>
</tr>
<tr id="line-34" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>34</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"><main> <span style="color: #6a9fb5">class=</span><span style="color: #90a959">"page-main"</span><span style="color: #f4bf75">></span>
</main></span></pre>
</td>
</tr>
<tr id="line-35" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>35</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"/></pre>
</td>
</tr>
<tr id="line-36" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>36</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #f4bf75"/>Home Page<span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-37" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>37</pre>
</td>
<td class="rouge-code">
<pre>        <span style="color: #949494"><!-- put more content here --></span>
</pre>
</td>
</tr>
<tr id="line-38" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>38</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-39" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>39</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-40" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>40</pre>
</td>
<td class="rouge-code">
<pre>    
</pre>
</td>
</tr>
<tr id="line-41" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>41</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #f4bf75"><script><![CDATA[<span style="color: #6a9fb5">src=]]></script></span><span style="color: #90a959">"main.js"</span><span style="color: #f4bf75">></span>   
</pre>
</td>
</tr>
<tr id="line-42" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>42</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #f4bf75"/>
</pre>
</td>
</tr>
<tr id="line-43" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>43</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75"/>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>Consider the inline styles that we add to the panels. As we’ll see later, we’ll use the <code>index</code> CSS variable to animate them. The bigger the value, the more time it’ll take for the associated element to animate.</p>
<h2 id="toc-dodh-define-some-basic-styles">
<span class="sectionnum">2. </span>Define some basic styles for <span>JS page loading</span><br />
</h2>
<p>Next, we’ll continue with some CSS variables and reset styles:</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table css">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0;background-color: #151515">:root</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">100%</span> <span style="color: #d0d0d0">/</span> <span style="color: #90a959">7</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">--darkblue</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">#02020c</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">--white</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">#fff</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">--lightgray</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">#fafafb</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">*</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">padding</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">margin</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">box-sizing</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">border-box</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">ul</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">list-style</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">none</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">a</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">color</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">inherit</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">text-decoration</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">none</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">h1</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">font-size</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">3rem</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-27" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>27</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">body</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-28" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>28</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">height</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">100vh</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-29" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>29</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">font-family</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">"Montserrat"</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0;background-color: #151515">sans-serif</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-30" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>30</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">color</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--white</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-31" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>31</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">background</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--darkblue</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-32" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>32</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">overflow</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">hidden</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-33" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>33</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>Three things to note:</p>
<ul>
</p>
<li>The <code>panel-width</code> variable will determine the panel width.</li>
<p>
</p>
<li>The page height will be equal to the viewport height.</li>
<p>
</p>
<li>We’ll hide any potential scrollbars that might appear depending on the amount of page content.</li>
<p>
</ul>
<h2 id="toc-8xam-specify-the-main-styles">
<span class="sectionnum">3. </span>Specify the main styles for the <span>JS page loading</span><br />
</h2>
<p>Let’s now concentrate on the <em>main</em> styles for the page loading JavaScript animation. We’ll leave out the header styles as they haven’t any importance.</p>
<div class="post__inarticle-ad-template">
<h3 id="toc-5q8l-the-panels">The panels</h3>
<p><span>The panels will be fixed-positioned elements, and their </span><code>width</code> <span>and</span> <code>left</code> <span>property values will depend on the </span><code>panel-width</code> <span>variable. That said, the</span> <code>left</code> <span>value for the first panel will be 0, for the second one around 14.28%, for the third one around 28.5%, and so on. Their height will be equal to the viewport height and invisible by default. We’ll use the <code>clip-path</code> property to squeeze and move them to the bottom part of the page.</span></p>
<h3 id="toc-kr2k-main-element">Main element</h3>
<p>The <code>main</code> element will be fullscreen with horizontally and vertically centered content. For simplicity, we’ll only put a heading and a link, but you can put anything you like. Again, by default, all this content will be invisible and sit 100px away from its original position. </p>
<p>Here are the relevant styles of the page loading JavaScript animation:</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table css">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #949494">/*CUSTOM VARIABLES HERE*/</span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">position</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">fixed</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">top</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">bottom</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">width</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">+</span> <span style="color: #90a959">1px</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">clip-path</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">inset</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">100%</span> <span style="color: #90a959">0</span> <span style="color: #90a959">0</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">background</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--lightgray</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transition</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">all</span> <span style="color: #90a959">1s</span> <span style="color: #d0d0d0;background-color: #151515">cubic-bezier</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">0.25</span><span style="color: #d0d0d0">,</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">,</span> <span style="color: #90a959">0.25</span><span style="color: #d0d0d0">,</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">2</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-18" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>18</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">3</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-19" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>19</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">2</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-20" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>20</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-21" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>21</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-22" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>22</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">4</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-23" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>23</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">3</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-24" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>24</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-25" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>25</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-26" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>26</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">5</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-27" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>27</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">4</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-28" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>28</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-29" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>29</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-30" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>30</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">6</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-31" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>31</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">5</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-32" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>32</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-33" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>33</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-34" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>34</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span><span style="color: #d0d0d0;background-color: #151515">:nth-child</span><span style="color: #d0d0d0">(</span><span style="color: #151515;background-color: #ac4142">7</span><span style="color: #d0d0d0">)</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-35" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>35</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">left</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--panel-width</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">6</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-36" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>36</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-37" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>37</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-38" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>38</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.page-main</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-39" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>39</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">display</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">flex</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-40" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>40</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">height</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">100%</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-41" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>41</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">padding</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">100px</span> <span style="color: #90a959">15px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-42" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>42</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">overflow-y</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">auto</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-43" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>43</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-44" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>44</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-45" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>45</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.page-main</span> <span style="color: #d0d0d0">></span> <span style="color: #f4bf75">div</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-46" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>46</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">text-align</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">center</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-47" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>47</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">margin</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">auto</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-48" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>48</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-49" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>49</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-50" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>50</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.page-main</span> <span style="color: #d0d0d0">></span> <span style="color: #f4bf75">div</span> <span style="color: #d0d0d0">></span> <span style="color: #d0d0d0">*</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-51" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>51</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">opacity</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-52" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>52</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transition</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">all</span> <span style="color: #90a959">0.5s</span> <span style="color: #d0d0d0;background-color: #151515">ease-out</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-53" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>53</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-54" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>54</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-55" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>55</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.page-main</span> <span style="color: #f4bf75">h1</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-56" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>56</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transform</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">translateY</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">-100px</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-57" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>57</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-58" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>58</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-59" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>59</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.page-main</span> <span style="color: #f4bf75">p</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-60" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>60</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">font-size</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">20px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-61" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>61</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">margin-top</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">20px</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-62" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>62</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transform</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">translateY</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">100px</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-63" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>63</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="callout-block">
<span class="callout-icon callout-info"/></p>
<div>
<p>info</p>
<p>
<span>if you check the <code>width</code></span> <span>value of the panels, you’ll notice there’s an extra pixel</span><span>. Its job is to make the panels overlap a little bit, and thus prevent the blue borders (their color will depend on the page color) between the adjacent panels. </span> </p>
</div>
</div>
<figure class="post_image"><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2YAAAHYAQAAAAAO8cZ/AAAAAnRSTlMAAHaTzTgAAABJSURBVHja7cExAQAAAMKg9U9tCF+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4DMrQAAEJmZAnAAAAAElFTkSuQmCC" alt="The blue lines that appear between the panels" loading="lazy" width="870px" height="472px" class="resized-image resized-image-desktop lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/borders.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio-rwidth="870" data-eio-rheight="472" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/borders.png" alt="The blue lines that appear between the panels" loading="lazy" width="870px" height="472px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAooAAAFjAQAAAACSrBf2AAAAAnRSTlMAAHaTzTgAAAAzSURBVHja7cExAQAAAMKg9U9tB2+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAwcxkAAbuyAPAAAAAASUVORK5CYII=" alt="The blue lines that appear between the panels" loading="lazy" width="650px" height="355px" class="resized-image resized-image-tablet lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/borders.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio-rwidth="650" data-eio-rheight="355" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/borders.png" alt="The blue lines that appear between the panels" loading="lazy" width="650px" height="355px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAADTAQAAAACqoZXoAAAAAnRSTlMAAHaTzTgAAAAhSURBVGje7cGBAAAAAMOg+VMf4ApVAQAAAAAAAAAAAJwBKGMAAYzgDEIAAAAASUVORK5CYII=" alt="The blue lines that appear between the panels" loading="lazy" width="380px" height="211px" class="resized-image resized-image-mobile lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/borders.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio-rwidth="380" data-eio-rheight="211" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/borders.png" alt="The blue lines that appear between the panels" loading="lazy" width="380px" height="211px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/borders.png 2x" data-eio="l" /></noscript></figure>
</div>
<h2 id="toc-99mk-fire-the-animations">
<span class="sectionnum">4.</span> Fire the JS animations</h2>
<p><span>When the page loads, the following page loading JavaScript animations have to play in this order:</span></p>
<ol>
</p>
<li>First, the panels should appear from bottom to top.</li>
<p>
</p>
<li>Then, the panels should disappear and move to the top.</li>
<p>
</p>
<li>Finally, all page contents should become visible.</li>
<p>
</ol>
<p>During the first two steps, the panels will be transitioned with some delay. As we’ve discussed before, this will depend on the value of their <code>index</code> variable.</p>
<h3 id="toc-v51j-mimic-a-timeline">Mimic a timeline</h3>
<p>To create<span> a sequence of tweens as we did the last time with <a rel="nofollow noopener" target="_blank" href="https://greensock.com/docs/v3/GSAP/Timeline">GSAP’s Timeline</a>, we’ll t</span>ake advantage of a lesser-known event called <code><a rel="nofollow noopener" target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Element/transitionend_event">transitionend</a></code>. This event fires each time a CSS transition finishes and gives us the ability to synchronize <span>page loading JS </span>animations.</p>
<p>Of course, we aren’t interested in all transitions, instead, we only care about the panels’ transitions and specifically the transitions of the last JS animated panel. In our case, the last animated panels will be the first and seventh (last) ones as both have <code>index: 3</code>. </p>
<figure class="post_image"><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2YAAAERAQAAAAA4FokDAAAAAnRSTlMAAHaTzTgAAAA0SURBVHja7cExAQAAAMKg9U9tCy+gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAeBnVOAAG6iZixAAAAAElFTkSuQmCC" alt="The transition delay of the last panel" loading="lazy" width="870px" height="273px" class="resized-image resized-image-desktop lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/transition_delay.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio-rwidth="870" data-eio-rheight="273" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/transition_delay.png" alt="The transition delay of the last panel" loading="lazy" width="870px" height="273px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAooAAADQAQAAAACohX2ZAAAAAnRSTlMAAHaTzTgAAAAnSURBVHja7cEBAQAAAIIg/69uSEABAAAAAAAAAAAAAAAAAAAAwI8BQ3AAAW1ufgcAAAAASUVORK5CYII=" alt="The transition delay of the last panel" loading="lazy" width="650px" height="208px" class="resized-image resized-image-tablet lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/transition_delay.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio-rwidth="650" data-eio-rheight="208" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/transition_delay.png" alt="The transition delay of the last panel" loading="lazy" width="650px" height="208px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAAB/AQAAAADEf0R9AAAAAnRSTlMAAHaTzTgAAAAdSURBVFjD7cGBAAAAAMOg+VPf4ARVAQAAAAAAXAMYTwABXBJM5gAAAABJRU5ErkJggg==" alt="The transition delay of the last panel" loading="lazy" width="380px" height="127px" class="resized-image resized-image-mobile lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/transition_delay.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio-rwidth="380" data-eio-rheight="127" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/transition_delay.png" alt="The transition delay of the last panel" loading="lazy" width="380px" height="127px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/transition_delay.png 2x" data-eio="l" /></noscript></figure>
<p>As you’ll see in the code, we’ll work with the last one, but we could equally have used the first one. To better understand it, try to give the selected panel a large delay of around 1s and see how the JavaScript animations get out of sync.</p>
<p>In terms of the code logic, we’ll do the following things in this order:</p>
<ol>
</p>
<li>First, when the page loads, we’ll add the <code>loaded</code> class to the <code>body</code>.</li>
<p>
</p>
<li>Then, we’ll wait till the transition of the last panel finishes<span>—this </span>will fire twice in total. At that point, we’ll add another class to the <code>body</code>. The first time we’ll add the <code>second-round</code> class, while the second time, we’ll add the <code>third-round</code>.</li>
<p>
</ol>
<p>After the completion of our transitions, the <code>body</code> will have these classes:</p>
<figure class="post_image"><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA2YAAAENAQAAAABMAkvjAAAAAnRSTlMAAHaTzTgAAAA0SURBVHja7cEBDQAAAMKg909tDjegAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAODNAHOWAAFSdHcDAAAAAElFTkSuQmCC" alt="The classes attached to the body" loading="lazy" width="870px" height="269px" class="resized-image resized-image-desktop lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/body_classes.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio-rwidth="870" data-eio-rheight="269" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=850/uploads/users/780/posts/93911/image-upload/body_classes.png" alt="The classes attached to the body" loading="lazy" width="870px" height="269px" class="resized-image resized-image-desktop" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1700/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAooAAADNAQAAAAAXzWzcAAAAAnRSTlMAAHaTzTgAAAAmSURBVHja7cEBAQAAAIIg/69uSEABAAAAAAAAAAAAAAAAAAAAcGhCdwABzjVndwAAAABJRU5ErkJggg==" alt="The classes attached to the body" loading="lazy" width="650px" height="205px" class="resized-image resized-image-tablet lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/body_classes.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio-rwidth="650" data-eio-rheight="205" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=630/uploads/users/780/posts/93911/image-upload/body_classes.png" alt="The classes attached to the body" loading="lazy" width="650px" height="205px" class="resized-image resized-image-tablet" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=1260/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio="l" /></noscript><img decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAXwAAAB9AQAAAACJt+V2AAAAAnRSTlMAAHaTzTgAAAAdSURBVFjD7cEBDQAAAMKg909tDjegAAAAAACAawMX7QABps/BFgAAAABJRU5ErkJggg==" alt="The classes attached to the body" loading="lazy" width="380px" height="125px" class="resized-image resized-image-mobile lazyload"  data-src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/body_classes.png" data-srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio-rwidth="380" data-eio-rheight="125" /><noscript><img decoding="async" src="https://cms-assets.tutsplus.com/cdn-cgi/image/width=360/uploads/users/780/posts/93911/image-upload/body_classes.png" alt="The classes attached to the body" loading="lazy" width="380px" height="125px" class="resized-image resized-image-mobile" srcset="https://cms-assets.tutsplus.com/cdn-cgi/image/width=720/uploads/users/780/posts/93911/image-upload/body_classes.png 2x" data-eio="l" /></noscript></figure>
<p>Here’s the JavaScript code:</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table javascript">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d28445">const</span> <span style="color: #d0d0d0;background-color: #151515">body</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">document</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">body</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d28445">const</span> <span style="color: #d0d0d0;background-color: #151515">lastPanel</span> <span style="color: #d0d0d0">=</span> <span style="color: #d0d0d0;background-color: #151515">document</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">querySelector</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">.panels .panel:last-child</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0;background-color: #151515">window</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">load</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">()</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">body</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">classList</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">add</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">loaded</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre>  
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">lastPanel</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">addEventListener</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">transitionend</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">,</span> <span style="color: #d0d0d0">()</span> <span style="color: #d0d0d0">=></span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #aa759f">if </span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">body</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">classList</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">contains</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">second-round</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">))</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0;background-color: #151515">body</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">classList</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">add</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">third-round</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d0d0d0">}</span> <span style="color: #aa759f">else</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>      <span style="color: #d0d0d0;background-color: #151515">body</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">classList</span><span style="color: #d0d0d0">.</span><span style="color: #d0d0d0;background-color: #151515">add</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">"</span><span style="color: #90a959">second-round</span><span style="color: #90a959">"</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre>    <span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">});</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<div class="callout-block">
<span class="callout-icon callout-tip"/></p>
<p>Instead of the <code>load</code> event, we could have used the <code>DOMContentLoaded</code> event.</p>
</div>
<p>And the corresponding styles of the <span>page loading JS animation</span>:</p>
<div class="rouge-syntax-highlight">
<table class="rouge-line-table css">
<tbody>
<tr id="line-1" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>1</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.loaded</span> <span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-2" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>2</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">clip-path</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">inset</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">0</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-3" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>3</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transition-delay</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">calc</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">var</span><span style="color: #d0d0d0">(</span><span style="color: #d0d0d0;background-color: #151515">--index</span><span style="color: #d0d0d0">)</span> <span style="color: #151515;background-color: #ac4142">*</span> <span style="color: #90a959">0.06s</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-4" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>4</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-5" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>5</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-6" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>6</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.loaded.second-round</span> <span style="color: #f4bf75">.panels</span> <span style="color: #f4bf75">.panel</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-7" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>7</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">clip-path</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">inset</span><span style="color: #d0d0d0">(</span><span style="color: #90a959">0</span> <span style="color: #90a959">0</span> <span style="color: #90a959">100%</span> <span style="color: #90a959">0</span><span style="color: #d0d0d0">);</span>
</pre>
</td>
</tr>
<tr id="line-8" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>8</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-9" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>9</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-10" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>10</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.loaded.third-round</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-11" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>11</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">overflow</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">auto</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-12" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>12</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
<tr id="line-13" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>13</pre>
</td>
<td class="rouge-code">
<pre>
</pre>
</td>
</tr>
<tr id="line-14" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>14</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #f4bf75">.loaded.third-round</span> <span style="color: #f4bf75">.page-main</span> <span style="color: #d0d0d0">></span> <span style="color: #f4bf75">div</span> <span style="color: #d0d0d0">></span> <span style="color: #d0d0d0">*</span> <span style="color: #d0d0d0">{</span>
</pre>
</td>
</tr>
<tr id="line-15" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>15</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">opacity</span><span style="color: #d0d0d0">:</span> <span style="color: #90a959">1</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-16" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>16</pre>
</td>
<td class="rouge-code">
<pre>  <span style="color: #d0d0d0;background-color: #151515">transform</span><span style="color: #d0d0d0">:</span> <span style="color: #d0d0d0;background-color: #151515">none</span><span style="color: #d0d0d0">;</span>
</pre>
</td>
</tr>
<tr id="line-17" class="lineno">
<td class="rouge-gutter gl" style="-moz-user-select: none;-ms-user-select: none;-webkit-user-select: none;user-select: none;">
<pre>17</pre>
</td>
<td class="rouge-code">
<pre><span style="color: #d0d0d0">}</span>
</pre>
</td>
</tr>
</tbody>
</table>
</div>
<h2 id="toc-xpfz-conclusion">Now you know how to put together a <span>page loading JS animation!</span><br />
</h2>
<p>Congrats, folks! We managed to build an attractive <a rel="nofollow noopener" target="_blank" href="https://tutsplus.github.io/simple-panels-animation/">JavaScript page loading animation</a> by staggering animations thanks to the <code>transitionend</code> event. Obviously, for more heavy use of <span>page loading JS</span> animations, a library like GSAP is a more robust approach to follow. Feel free to extend the demo as you wish and share it with me!</p>
<p>As always, thanks a lot for reading!</p>
<h2 id="toc-q6u2-learn-css-with-these-projects">More projects to practice</h2>
<p><span>Take a look at these projects on Tuts+ that use the <code>clip-path</code> property to apply different kinds of animations.</span></p>
</div>
<p><br />
<br /><a href="https://webdesign.tutsplus.com/how-to-build-a-javascript-page-loading-animation--cms-93911t" target="_blank" rel="noopener">Source link </a></p>
</p>
                                    

                            
                            <!-- // post -->

                                                        <hr>

                            
                       
                        
                    </div>
                    <div class="col-md-3">
                                                 
       
           <div class="side-bar"><h3>Recent Posts</h3><div  class="rpwe-block"><ul class="rpwe-ul"><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/green-web-hosting-the-complete-guide/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="Green Web Hosting: The Complete Guide" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2025/03/Green-Web-Hosting-The-Complete-Guide-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2025/03/Green-Web-Hosting-The-Complete-Guide-60x60.png" alt="Green Web Hosting: The Complete Guide" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/green-web-hosting-the-complete-guide/" target="_self">Green Web Hosting: The Complete Guide</a></h3><time class="rpwe-time published" datetime="2025-03-13T18:10:35+00:00">March 13, 2025</time></li><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/how-to-host-your-own-website-beginner-guide/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="How to Host Your Own Website: Beginner Guide" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2025/03/How-to-Host-Your-Own-Website-Beginner-Guide-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2025/03/How-to-Host-Your-Own-Website-Beginner-Guide-60x60.png" alt="How to Host Your Own Website: Beginner Guide" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/how-to-host-your-own-website-beginner-guide/" target="_self">How to Host Your Own Website: Beginner Guide</a></h3><time class="rpwe-time published" datetime="2025-03-12T17:51:58+00:00">March 12, 2025</time></li><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/inmotion-hosting-launches-new-2-vcpu-vps-plan-at-4-49-month/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="InMotion Hosting Launches New 2 vCPU VPS Plan at $4.49/Month" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2025/03/InMotion-Hosting-Launches-New-2-vCPU-VPS-Plan-at-449Month-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2025/03/InMotion-Hosting-Launches-New-2-vCPU-VPS-Plan-at-449Month-60x60.png" alt="InMotion Hosting Launches New 2 vCPU VPS Plan at $4.49/Month" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/inmotion-hosting-launches-new-2-vcpu-vps-plan-at-4-49-month/" target="_self">InMotion Hosting Launches New 2 vCPU VPS Plan at $4.49/Month</a></h3><time class="rpwe-time published" datetime="2025-03-11T13:26:05+00:00">March 11, 2025</time></li></ul></div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ --></div><div class="widget_text side-bar"><div class="textwidget custom-html-widget"><center>
<a href="https://siteground.com/web-hosting.htm?afimagecode=02f8be890b03bb4b57bf3fb7046fd0c7" target="_blank" rel="noopener"><img border="0" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="https://uapi.siteground.com/img/affiliate/en/NOPRICE/general_EN_general-hosting-square-light.jpg" decoding="async" class="lazyload"><noscript><img border="0" src="https://uapi.siteground.com/img/affiliate/en/NOPRICE/general_EN_general-hosting-square-light.jpg" data-eio="l"></noscript></a>
</center>

</div></div>    
       
      
           <div class="couponside"><h3>Hosting Discounts</h3><div  class="rpwe-block"><ul class="rpwe-ul"><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/hrdiscount/cloudways-discount/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="cloudways Discount" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2022/08/cloudways2-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2022/08/cloudways2-60x60.png" alt="cloudways Discount" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/hrdiscount/cloudways-discount/" target="_self">cloudways Discount</a></h3><time class="rpwe-time published" datetime="2022-08-21T12:34:12+00:00">August 21, 2022</time></li><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/hrdiscount/hostinger-discount/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="Hostinger Discount" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2022/08/hostinger_square-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2022/08/hostinger_square-60x60.png" alt="Hostinger Discount" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/hrdiscount/hostinger-discount/" target="_self">Hostinger Discount</a></h3><time class="rpwe-time published" datetime="2022-08-21T12:24:17+00:00">August 21, 2022</time></li><li class="rpwe-li rpwe-clearfix"><a class="rpwe-img" href="https://payless.host/hrdiscount/dreamhost-discount/" target="_self"><img class="rpwe-alignleft rpwe-thumb lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAA5JREFUGBljGAWjAAcAAAIcAAGUPf81AAAAAElFTkSuQmCC" alt="DreamHost Discount" height="60" width="60" loading="lazy" decoding="async" data-src="https://payless.host/wp-content/uploads/2020/08/dreamhost-lg-60x60.png" data-eio-rwidth="60" data-eio-rheight="60"><noscript><img class="rpwe-alignleft rpwe-thumb" src="https://payless.host/wp-content/uploads/2020/08/dreamhost-lg-60x60.png" alt="DreamHost Discount" height="60" width="60" loading="lazy" decoding="async" data-eio="l"></noscript></a><h3 class="rpwe-title"><a href="https://payless.host/hrdiscount/dreamhost-discount/" target="_self">DreamHost Discount</a></h3><time class="rpwe-time published" datetime="2020-08-31T12:54:29+00:00">August 31, 2020</time></li></ul></div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ --></div>    
               
          
                      
                                             
                          
                        </div>
                </div>
            </div>
             <!-- END: PAGE CONTENT -->
    </section>
       <!-- END: PAGE CONTENT SECTION -->

 <!-- footer section -->
    <section class="footer" style="
                            background:#2c3644;

">
        <div class="container">

            <div class="row">

                <div class="col-md-3">
               <h3><img  class="img-fluid lazyload" alt="" data-src="http://payless.host/wp-content/uploads/2022/08/footer.png" decoding="async" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfMAAAB5AQMAAAAXnVoCAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAABxJREFUWMPtwQEBAAAAgJD+r+4ICgAAAAAAAABqHkAAAdlW1n0AAAAASUVORK5CYII=" data-eio-rwidth="499" data-eio-rheight="121" /><noscript><img src=http://payless.host/wp-content/uploads/2022/08/footer.png class="img-fluid" alt="" data-eio="l" /></noscript></h3>
                <p>Web hosting is a confusing it's hard to know where to start. That's why we created a payless.host show you the best providers available.</p>
                <a href="#" target="_blank"><i class="fa fa-facebook"></i></a>
                  <a href="#" target="_blank"><i class="fa fa-instagram"></i></a>
                   <a href="#" target="_blank"><i class="fa fa-twitter"></i></a>
                </div>
                <div class="col-md-3">
                
                   <div class="fwidget"><h3>Quick Links</h3><div class="menu-footer-menu-1-container"><ul id="menu-footer-menu-1" class="menu"><li id="menu-item-139" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home menu-item-139"><a href="https://payless.host/">Home</a></li>
<li id="menu-item-58" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-58"><a href="https://payless.host/top-6-web-hosting/">Top  Web Hosting</a></li>
<li id="menu-item-124" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-124"><a href="http://payless.host/hrdiscount/">Deals and Discounts</a></li>
<li id="menu-item-123" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-123"><a href="http://payless.host/hrreviews/">Web Hosting Reviews</a></li>
</ul></div></div>
                 
                </div>
                <div class="col-md-3">
                
                   <div class="fwidget"><h3>Website Info</h3><div class="menu-footer-menu-2-container"><ul id="menu-footer-menu-2" class="menu"><li id="menu-item-83" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-83"><a href="https://payless.host/privacy-policy/">Privacy Policy</a></li>
<li id="menu-item-107" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-107"><a href="https://payless.host/terms-of-use/">Terms Of Use</a></li>
<li id="menu-item-85" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-85"><a href="https://payless.host/contact-us/">Contact Us</a></li>
</ul></div></div>
                 
                </div>
                <div class="col-md-3">
                
                   <div class="fwidget">			<div class="textwidget"></div>
		</div>
                 
                </div>

            </div>


        
        </div>

       
    </section>
<footer>
    <div class="copyright text-center" style="background:#262f3c">
            <div class="col-md-12">
               <p>Copyright © 2025 Payless.Host – Web Hosting Reviews | All rights reserved</p>
            </div>
     </div>
</footer>
    <!-- end footer section -->
 


<script>
              (function(e){
                  var el = document.createElement('script');
                  el.setAttribute('data-account', 'WQ2HViv0xA');
                  el.setAttribute('src', 'https://cdn.userway.org/widget.js');
                  document.body.appendChild(el);
                })();
              </script>			<script>
				const lazyloadRunObserver = () => {
					const lazyloadBackgrounds = document.querySelectorAll( `.e-con.e-parent:not(.e-lazyloaded)` );
					const lazyloadBackgroundObserver = new IntersectionObserver( ( entries ) => {
						entries.forEach( ( entry ) => {
							if ( entry.isIntersecting ) {
								let lazyloadBackground = entry.target;
								if( lazyloadBackground ) {
									lazyloadBackground.classList.add( 'e-lazyloaded' );
								}
								lazyloadBackgroundObserver.unobserve( entry.target );
							}
						});
					}, { rootMargin: '200px 0px 200px 0px' } );
					lazyloadBackgrounds.forEach( ( lazyloadBackground ) => {
						lazyloadBackgroundObserver.observe( lazyloadBackground );
					} );
				};
				const events = [
					'DOMContentLoaded',
					'elementor/lazyload/observe',
				];
				events.forEach( ( event ) => {
					document.addEventListener( event, lazyloadRunObserver );
				} );
			</script>
			<link rel='stylesheet' id='rpwe-style-css' href='https://payless.host/wp-content/plugins/recent-posts-widget-extended/assets/css/rpwe-frontend.css?ver=2.0.2' type='text/css' media='all' />
<script type="text/javascript" id="eio-lazy-load-js-before">
/* <![CDATA[ */
var eio_lazy_vars = {"exactdn_domain":"","skip_autoscale":0,"threshold":0,"use_dpr":1};
/* ]]> */
</script>
<script type="text/javascript" src="https://payless.host/wp-content/plugins/ewww-image-optimizer/includes/lazysizes.min.js?ver=812" id="eio-lazy-load-js" async="async" data-wp-strategy="async"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js?ver=1.0" id="jquery-ui-js-js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js?ver=1.0" id="popper-js"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js?ver=1.0" id="bootstrap-js-js"></script>
<script type="text/javascript" id="site-reviews-js-before">
/* <![CDATA[ */
window.hasOwnProperty("GLSR")||(window.GLSR={Event:{on:()=>{}}});GLSR.action="glsr_public_action";GLSR.addons=[];GLSR.ajaxpagination=["#wpadminbar",".site-navigation-fixed"];GLSR.ajaxurl="https://payless.host/wp-admin/admin-ajax.php";GLSR.captcha=[];GLSR.nameprefix="site-reviews";GLSR.starsconfig={"clearable":false,tooltip:"Select a Rating"};GLSR.state={"popstate":false};GLSR.text={closemodal:"Close Modal"};GLSR.urlparameter="reviews-page";GLSR.validationconfig={field:"glsr-field",form:"glsr-form","field_error":"glsr-field-is-invalid","field_hidden":"glsr-hidden","field_message":"glsr-field-error","field_required":"glsr-required","field_valid":"glsr-field-is-valid","form_error":"glsr-form-is-invalid","form_message":"glsr-form-message","form_message_failed":"glsr-form-failed","form_message_success":"glsr-form-success","input_error":"glsr-is-invalid","input_valid":"glsr-is-valid"};GLSR.validationstrings={accepted:"This field must be accepted.",between:"This field value must be between %s and %s.",betweenlength:"This field must have between %s and %s characters.",email:"This field requires a valid e-mail address.",errors:"Please fix the submission errors.",max:"Maximum value for this field is %s.",maxfiles:"This field allows a maximum of %s files.",maxlength:"This field allows a maximum of %s characters.",min:"Minimum value for this field is %s.",minfiles:"This field requires a minimum of %s files.",minlength:"This field requires a minimum of %s characters.",number:"This field requires a number.",pattern:"Please match the requested format.",regex:"Please match the requested format.",required:"This field is required.",tel:"This field requires a valid telephone number.",url:"This field requires a valid website URL (make sure it starts with http or https).",unsupported:"The review could not be submitted because this browser is too old. Please try again with a modern browser."};GLSR.version="7.2.6";
/* ]]> */
</script>
<script type="text/javascript" src="https://payless.host/wp-content/plugins/site-reviews/assets/scripts/site-reviews.js?ver=7.2.6" id="site-reviews-js" data-wp-strategy="defer"></script>
<script type="text/javascript" id="site-reviews-js-after">
/* <![CDATA[ */
function glsr_init_elementor(){GLSR.Event.trigger("site-reviews/init")}"undefined"!==typeof jQuery&&(jQuery(window).on("elementor/frontend/init",function(){elementorFrontend.elements.$window.on("elementor/popup/show",glsr_init_elementor);elementorFrontend.hooks.addAction("frontend/element_ready/site_review.default",glsr_init_elementor);elementorFrontend.hooks.addAction("frontend/element_ready/site_reviews.default",glsr_init_elementor);elementorFrontend.hooks.addAction("frontend/element_ready/site_reviews_form.default",glsr_init_elementor);}));
/* ]]> */
</script>

</body>
</html>


<!-- Page cached by LiteSpeed Cache 6.5.4 on 2025-03-14 05:09:43 -->