I have a function that creates a loading block that lasts 1 second on the screen, so when I call this function, the page scroll is disabled for 1 second as well. After that 1 second the scroll returns to normal.
Image of the animation I am referring to:
MyJavaScriptcode:
function AnimacaoCarregamento() {
var block = $('#overlay').parent(); // cria o bloco de carregamento
$(block).block({
message: '<i class="icon-spinner4 spinner"></i>',
timeout: 1000, //unblock after 2 seconds
overlayCSS: {
backgroundColor: '#2b2c46',
opacity: 0.9,
cursor: 'wait',
},
css: {
border: 0,
padding: 0,
color: '#fff',
backgroundColor: 'transparent'
}
});
function setTopo() {
$(window).scrollTop(0);
}
$(window).bind('scroll', setTopo);
}