1

I have a class js-drawer-open that gets applied to the body & html when a drawer is triggered to open.

.js-drawer-open {
    overflow: hidden;
}

This works perfectly on desktop to prevent content outside the drawer from scrolling when the drawer is open. However on IOS this doesn't work as the element inside the body are position:absolute. The only way I could get it to work was with the following...

.js-drawer-open {
    height: 100%;
    overflow: hidden;
    width: 100%;
    position: fixed;
}

But now my issue is if you scroll down the page and then open the drawer the page jumps back to the top of the screen which can be very frustrating for the user.

I think this is due to position: fixed being applied and I wanted to know if there is any way around this?

Any help would be much appreciated.

user2498890
  • 1,528
  • 4
  • 25
  • 58

1 Answers1

0

Maybe I'm missing something as you don't have a fiddle, but it sounds like your click event causes the jump to the top of your page. Take a look at: How to prevent a click on a '#' link from jumping to top of page in jQuery

Community
  • 1
  • 1
  • Thanks for you answer, the trigger to open the drawer is a button ` – user2498890 Jul 24 '15 at 13:41
  • I can include the js I'm using. It's actually from the Shopify Timber js as thats what Im using to build a theme. As I'm not great with js this may be where I'm going wrong? – user2498890 Jul 24 '15 at 13:45