3

Okay, so I have a fixed position div that has a specified width. When the content is long enough to require overflow in one device orientation (landscape), but not the other (portrait) scrolling stops working if the device changes orientation.

This issue occurs with iOS7 (unable to test previous versions)

Here is the address of the example: https://r3dux.com/css/overflow.php

Here is an illustration of the issue:

overflow issue

10
  • Yes, I tested it in iOS7 and iOS6 and both worked perfectly fine. Commented May 27, 2014 at 16:19
  • Weird, I've tested it in iOS simulator, on my iPhone, and iPad (with more content) and it stops working when orientation is changed. Commented May 27, 2014 at 16:20
  • Maybe go into Safari and change your User Agent to an iOS device User Agent and see if it works properly. Commented May 27, 2014 at 16:24
  • It works fine on desktop safari... that's not the issue. I not sure I see how changing the user agent will affect a browser's behavior like that. Commented May 27, 2014 at 16:25
  • Apparently if you redraw the div on orientation change it works again. (toggle display: block; to display: none; and back to display: block;) - really annoyed that this is needed. Commented May 27, 2014 at 16:33

1 Answer 1

7

I fixed that problem with CSS.

@media (orientation: landscape) {
 .webkit-scroll-container > * {
   -webkit-animation: fixWebkitOverflowScroll 1s;
 }
 @-webkit-keyframes fixWebkitOverflowScroll {
   0% {
     padding-bottom: 1px;
   }
   100% {
     padding-bottom: 0px;
   }
 }
}

Just put it inside your stylesheet, assign the class .webkit-scroll-container and everything will work as expected. I just animate the height, which triggers a reflow/redraw of the scroll container.

Sign up to request clarification or add additional context in comments.

2 Comments

does this fix the ovelaying issue? (if the is a div over the fixed div, the scrolling goes to the fixed div)
Assume something like that: <div class="scroll" style="-webkit-overflow-scrolling:touch;"><div class=".content">Your actual content</div></div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.