JS/JQuery - Loading
Adicionar um loading à webapplication, a funcionar de forma autónoma.
Para isto, bastará clocar o seguinte código na masterpage.
<style>
.loading {
position:fixed;
width:100%;
left:0;right:0;top:0;bottom:0;
background-color: rgba(255,255,255,0.7);
z-index:9999;
}
.loading::after {
content:'';
position:absolute;
left:48%;top:40%;
width:70px;
height:70px;
border: 10px dotted #a33038;
border-top-color:transparent;
border-radius:50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
</style>
<script>
window.onbeforeunload = function () {
$("body").append("<div class='loading'></div>");
};
$(window).load(function () {
$(".loading").remove();
});
$(document).ready(function () {
fileDownloadCheckTimer = window.setInterval(function () {
var cookieValue = getCookie('fileDownloadToken');
console.log(cookieValue);
if (cookieValue == null || cookieValue != "0") {
setCookie('fileDownloadToken', '0;path=/');
$(".loading").remove();
}
}, 1000);
});
</script>
<style>
.loading {
position:fixed;
width:100%;
left:0;right:0;top:0;bottom:0;
background-color: rgba(255,255,255,0.7);
z-index:9999;
}
.loading::after {
content:'';
position:absolute;
left:48%;top:40%;
width:70px;
height:70px;
border: 10px dotted #a33038;
border-top-color:transparent;
border-radius:50%;
-webkit-animation: spin .8s linear infinite;
animation: spin .8s linear infinite;
}
</style>
<script>
window.onbeforeunload = function () {
$("body").append("<div class='loading'></div>");
};
$(window).load(function () {
$(".loading").remove();
});
$(document).ready(function () {
fileDownloadCheckTimer = window.setInterval(function () {
var cookieValue = getCookie('fileDownloadToken');
console.log(cookieValue);
if (cookieValue == null || cookieValue != "0") {
setCookie('fileDownloadToken', '0;path=/');
$(".loading").remove();
}
}, 1000);
});
</script>
Comments
Post a Comment