18

I have an HTML page with a fixed-height div which should be scrollable (only vertically). In iOS 5 this can be achieved using:

overflow-y: auto;
-webkit-overflow-scrolling: touch;

The div contains an unordered list with about 10 items.

The scrolling works, but sometimes it scrolls only if I swipe my finger diagonally or even horizontally and not vertically as it should be.

I'm wondering if anyone has encountered this issue. I don't want to think that it is a bug in iOS5, but I can't figure out what I'm doing wrong because most of the time it works fine.

3
  • 1
    Did you find a fix or a workaround? I ran into the same problem and can't get my head around it... Commented May 9, 2012 at 12:01
  • I started a bounty so I can give it to paul. Commented Sep 9, 2012 at 19:45
  • Relevant discussion in Google Groups Commented Sep 9, 2012 at 19:50

4 Answers 4

10
+400

I had exactly the same issue. The problem turned out to be caused by two zero size iframes my site used to track history changes and load scripts. Removing these fixed the issue. I filed a bug with apple, waiting to hear back from them.

Check to see if you have any iframes on your page they could be the cause.

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

4 Comments

Have you heard anything from Apple? Or have you found another workaround than removing the iframes? I ran into this issue when trying to get -webkit-overflow-scrolling to work with vaadin.
Bump on this, seeing a similar issue: stackoverflow.com/questions/10718296/… Flipping between portrait and landscape seems to fix the problem. No idea the cause though (no iframes on my page).
Flipping, 3d-transform and iframe removal don't do anything for me. Starting a bounty
After I spent a couple of evenings on this bug, removing the invisible iframe resolved the issue. You, sir, are awesome.
4

I have found a hacky solution but it needs javascript...

I stumbled upon that problem while loading scrollable nodes via ajax and appending them with js.

I found out that resetting the -webkit-overflow-scrolling property with js saved the day

JS CODE:

var myDiv = $('.myDiv');
myDiv.css('-webkit-overflow-scrolling','auto');
function fn(){
    myDiv.css('-webkit-overflow-scrolling','touch');
}
setTimeout(fn,500);

It really sucks that we have to call the setTimeout method but that's the only way I could think of...

EDIT : Watch out for display:none

Webkit overflow scrolling touch CSS bug on iPad

1 Comment

THANK YOU! It is hacky, but as far as I'm concerned, this is an iOS bug in the first place.
2

You need to put this css setting in your css file - the one you load using the content_css configuration variable:

body {
    -webkit-transform: translate3d(0, 0, 0);
}

The other option is to set the css directly from code on tinymce initialization:

$(tinymce.activeEditor.getBody()).css('-webkit-transform', translate3d(0, 0, 0));

Comments

2

I had the same problem in iOS 5.1.1 and it turned out to be due to an ::after pseudo-element with position: fixed that was on an element that contained the scrollable list exhibiting the "wrong scroll axis" behavior. Details here.

Comments

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.