4 04, 2017

Prevent Scrolling Behind a Fixed Overlay and Maintain Scroll Position on Mobile Devices

By | 2017-03-31T14:16:18+00:00 April 4th, 2017|Categories: Web Development|Tags: , , |

This is a great piece of code if you need to have an overlay on a mobile device and do not want the background to scroll when you have to interact with the overlay.

The below is an example of the javascript. You can change the ‘getElementById’ name to fit with your overlay ID name in the code below, add -webkit-overflow-scrolling: touch; to the #overlay or ID element of your code, and that’s all there is to it.


Source: Stackoverflow