J Scott Smith

Scrolling Lock for iOS 8

Notes - February 19th, 2015

Occasionally you may want to (temporarily) lock the scroll position on the <body>. To do so on iOS 8 takes a bit more effort than just adding overflow: hidden but you can manage the effect by adding the following additional attributes to a .scroll-lock class.

.scroll-lock {
  height: 100%;
  overflow: hidden;
  width: 100%;
  position: fixed;

I’ve recently used this to lock scrolling when a lightbox effect is active. Just toggle the .scroll-lock class on the <body> and you should effectively lock the position of the body. Cool.

Found this tip here.