2
I have a function that creates a load block that lasts 1 second on the screen, I need that when I call this function, the page scroll is disabled for 1 second as well. After that 1 second scroll back to normal.
Image of the animation I’m talking about:
My Javascript code:
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);
}
The function setTopo()
disables the scroll of the screen, but is disabled forever, and I need it to return to normal.
Put in your function a
timeout
which will enable scroll again after 1s. Would look like this:setTimeout(function(){ $('html body').css('overflow', 'visible') },1000)
– Jorge.M
I’ll try, I’ll get back to you if it worked.
– Renan
I edited the comment and put an example
– Jorge.M
@Renan, See this thread https://stackoverflow.com/questions/4770025/how-to-disable-scrolling-temporarily. There are examples working - apparently - just the way you want. [] s
– Bleno Lopes
Thanks Bieno, I had not found this link.
– Renan