Tuesday 11 August 2015

Loading spinner overlay for hybrid/mobile web applications

Below is the spinner I have implemented in one of my projects. Below are the components you need to place in your respective Javascript, Css and HTML pages -

Javascript:
function showOverlay() {
document.getElementById("OVERLAY_ID").style.display = "block";
}

function hideOverlay() {
document.getElementById("OVERLAY_ID").style.display = "none";
}

CSS:
.overlay {
Spinner Image(loading.gif)
    background-color: grey;
    top:0;
    left:0;
    width:100%;
    height:100%;
    position: absolute;
    -moz-opacity: 0.70;
    opacity:.70;
    filter: alpha(opacity=70);
 }
.loaderPosition {
    margin:0 auto;
    height:42px;
    width:42px;
    position:absolute;
    top:48%;
    left:46%;
 }

HTML:
<div id="OVERLAY_ID" class="overlay" style="display:none">
<img src="img/loading.gif" alt="Loading..." class="loaderPosition">
</div>


No comments:

Post a Comment