Loader CSS on VBCS Page

1. Add the function to the webapp js:

 AppModule.prototype.hideShowLoader = function(loaderId,display) {

    if(document.getElementById(loaderId.toString())){

      document.getElementById(loaderId.toString()).style.display = display.toString();

    }

  }

2. Add to the app.css file

.spinner {

   position: absolute;

   left: 50%;

   top: 50%;

   height:60px;

   width:60px;

   margin:0px auto;

   -webkit-animation: rotation .6s infinite linear;

   -moz-animation: rotation .6s infinite linear;

   -o-animation: rotation .6s infinite linear;

   animation: rotation .6s infinite linear;

   border-left:6px solid rgba(6, 6, 248,.15);

   border-right:6px solid rgba(6, 6, 248,.15);

   border-bottom:6px solid rgba(6, 6, 248,.15);

   border-top:6px solid rgba(6, 6, 248,1);

   border-radius:100%;

  

}

@-webkit-keyframes rotation {

   from {-webkit-transform: rotate(0deg);}

   to {-webkit-transform: rotate(359deg);}

}

@-moz-keyframes rotation {

   from {-moz-transform: rotate(0deg);}

   to {-moz-transform: rotate(359deg);}

}

@-o-keyframes rotation {

   from {-o-transform: rotate(0deg);}

   to {-o-transform: rotate(359deg);}

}

@keyframes rotation {

   from {transform: rotate(0deg);}

   to {transform: rotate(359deg);}

}

.overlay {

    position: fixed;

left: 0px;

top: 0px;

width: 100%;

height: 100%;

z-index: 9999;

background: url("../images/loader-main.gif") center no-repeat #fff;

}

@-webkit-keyframes rotation {

   from {-webkit-transform: rotate(0deg);}

   to {-webkit-transform: rotate(359deg);}

}

@-moz-keyframes rotation {

   from {-moz-transform: rotate(0deg);}

   to {-moz-transform: rotate(359deg);}

}

@-o-keyframes rotation {

   from {-o-transform: rotate(0deg);}

   to {-o-transform: rotate(359deg);}

}

@keyframes rotation {

   from {transform: rotate(0deg);}

   to {transform: rotate(359deg);}

}

#loader {

  position: fixed;

  display: none;

  width: 100%;

  height: 100%;

  top: 0;

  left: 0;

  right: 0;

  bottom: 0;

  background-color: rgba(0,0,0,0.5);

  z-index: 2;

  cursor: pointer;

}

#loader-main {

  position: fixed;

  display: none;

  width: 100%;

  height: 100%;

  top: 0;

  left: 0;

  right: 0;

  bottom: 0;

  background-color: rgba(0,0,0,0.5);

  z-index: 2;

  cursor: pointer;

}

3. Call the function to the action chain where the loader needs to be loaded.

LoaderId = loader-main 

Display = Block

End the call with 

LoaderId = loader-main 

Display = none

4. Add on the top of the page code editor:

<div id="loader-main" class="overlay" style="display:none">

      <div class="spinner"></div>

</div>


Comments