I Use This JavaScript until my page loads it shows a simple image.but the problem is the users can scroll the page making the loading animation move up.i want to prevent this.anyone please help me.here is the code i use.Scrolling Is Prevented In Linux(ubuntu) But I am Able To Scroll In Windows
Approach: A simple solution to this problem is to set the value of the “overflow” property of the body element to “hidden” whenever the modal is opened, which disables the scroll on the selected element.
Use this to disable scroll:
No Scroll
$('html, body').css({
'overflow': 'hidden',
'height': '100%'
})
and again this to enable scroll after page load completes or page ready:
Scroll
$('html, body').css({
'overflow': 'auto',
'height': 'auto'
})
Revert back if any issues,though tested on major browsers...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With