1

I have a panel that opens but on IOS the body is scrolling behind the panel.

I am using window.onscroll = function () { window.scrollTo(0, 0); to stop the page scrolling behind the panel when the panel is open.

However, I need to resume normal scrolling afterwards in an event handler. What javascript can I use to resume normal scrolling? as currently when the panel is closed when you try to scroll you get positioned back to (0,0) of the window.

Thank you!

BennKingy
  • 1,265
  • 1
  • 18
  • 43

1 Answers1

1

When the panel is opened you set the onscroll function

window.onscroll = function () { window.scrollTo(0, 0);}

when the panel is closed:

window.onscroll = null;
Albondi
  • 1,141
  • 1
  • 8
  • 19