CSS Real Time Page Loading bar │Real time Page Loading bar CSS Code

CSS Section


 
/*====================================
* Preloader Start
======================================*/
#preloder {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 999999;
  background: #0000006e;
}

@keyframes rotate {
  0% {
    -webkit-transform: rotate(0deg) scale(1);
    transform: rotate(0deg) scale(1);
  }
  50% {
    -webkit-transform: rotate(180deg) scale(0.6);
    transform: rotate(180deg) scale(0.6);
  }
  100% {
    -webkit-transform: rotate(360deg) scale(1);
    transform: rotate(360deg) scale(1);
  }
}

.loader {
  width: 26px;
  height: 26px;
  position: absolute;
  top: 50%;
  left: 50%;

  -webkit-transform: translateY(-25px);
  transform: translateY(-25px);
}

.loader>div {
  -webkit-animation-fill-mode: both;
  animation-fill-mode: both;
  position: absolute;
  left: -20px;
  top: -20px;
  border: 2px solid #fff;
  border-bottom-color: transparent;
  border-top-color: transparent;
  border-radius: 100%;
  height: 35px;
  width: 35px;
  -webkit-animation: rotate 1s 0s ease-in-out infinite;
  animation: rotate 1s 0s ease-in-out infinite;
}

.loader>div:last-child {
  display: inline-block;
  top: -10px;
  left: -10px;
  width: 15px;
  height: 15px;
  -webkit-animation-duration: 0.5s;
  animation-duration: 0.5s;
  border-color: #fff transparent #fff transparent;
  -webkit-animation-direction: reverse;
  animation-direction: reverse;
}

/*====================================
* Preloader End
======================================*/

Body HTML Section

<!-- Page Loader Start -->
  <div id='preloder'>
    <div class='loader'><div/><div/><div/></div>
  </div>
           <!-- Page Loader End -->

Script Section

<script>
    document.onreadystatechange = function () {
            if (document.readyState === &quot;complete&quot;) {
                console.log(document.readyState);
                document.getElementById(&quot;preloder&quot;).style.display = &quot;none&quot;;
            }
        }
</script>

Preview: