Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Prevent Scrolling Until The Page Loads

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

like image 772
Anandu Avatar asked Sep 29 '13 05:09

Anandu


People also ask

How do I stop background scrolling from popping up when open?

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.


1 Answers

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...

like image 118
wildbisu Avatar answered Sep 28 '22 09:09

wildbisu