Skip to content

Instantly share code, notes, and snippets.

@tarun-nagpal-github
Created July 10, 2018 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarun-nagpal-github/ba15a273d30b0d1be62508abcc79df8d to your computer and use it in GitHub Desktop.
Save tarun-nagpal-github/ba15a273d30b0d1be62508abcc79df8d to your computer and use it in GitHub Desktop.
CSS Loader (without library) - Pure HTML, CSS and JS based loader
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demo</title>
<style type="text/css">
#fade {
display: none;
position:absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: #ababab;
z-index: 1001;
-moz-opacity: 0.8;
opacity: .70;
filter: alpha(opacity=80);
}
#modal {
display: none;
position: absolute;
top: 45%;
left: 45%;
width: 64px;
height: 64px;
padding:30px 15px 0px;
border: 3px solid #ababab;
box-shadow:1px 1px 10px #ababab;
border-radius:20px;
background-color: white;
z-index: 1002;
text-align:center;
overflow: auto;
}
</style>
</head>
<body>
<div id="content">
<div id="fade"></div>
<div id="modal">
<img id="loader" src="https://image.ibb.co/d8SYZ8/loading.gif" / alt="Loader Image">
</div>
</div>
<script type="text/javascript">
openModal();
function openModal() {
document.getElementById('modal').style.display = 'block';
document.getElementById('fade').style.display = 'block';
}
function closeModal() {
document.getElementById('modal').style.display = 'none';
document.getElementById('fade').style.display = 'none';
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment