"-webkit-overflow-scrolling: touch" breaks css 3d perspective "-webkit-overflow-scrolling: touch" breaks css 3d perspective ios ios

"-webkit-overflow-scrolling: touch" breaks css 3d perspective


Update, May 29

Doh! I so stupid. The below, while true...ish doesn't address the question well enough.

If you want that configuration of the rotation to stay the same as you have illustrated, add a div between .scroll and .el, and style it such:

{perspective:300px;}

Thus, it would seem that you want the .pers div switched with .scroll or add another after .scroll with the same perspective.

Also, try moving the perspective: 300px; to .scroll. The angle appears to change as one scroll up or down.


Original Answer

The answer is not really. One cannot contain a 3D transform inside a container with clipping which is being attempted here.

The problem is overflow-y:scroll breaks the transform-style property as per spec. The overflow-y affects the nested element. If your problem persists, you may also have to use the -WebKit-transform-style: preserve-3d declaration on .scroll, though I think iOS already has a stacking context established in this case (Firefox requires this, Webkit seems not to).

One solution is to remove your overflow:hidden from body and overflow-y:scroll from .scroll, but I suspect you are going to want to have that as a smaller part of the page/screen and move image blocks inside it.

If this is the case, you will need fake this with transforms and some clever hackery and should use opacity be part of this endeavor, please note that this too (as in spec above, right below the transform-style) causes the flattening effect when not applied to the final node. Let's say you had opacity other than 1 on .el, you are fine here as .el is the final node, but if opacity was applied to .scroll, the same flattening of .el occurs as with the overflow.

Have yet to test on iOS as I lack access to the device.

Note: setting an overflow value other than visible for the body does not cause this issue on most desktop browsers that support 3D transforms. I do not know about iOS/mobile.


I think it is the bug that didn't fixed from apple yet.only way to solve this problem is put container with Higher height and perspective around element then make upper container to scroll it.

<div class="pers">  <div class="scroll">     <div class="widerHeight">       <div class="el">       </div>     </div>  </div></div>

.

.pers {/*perspective:300px;*/}.scroll {overflow-y:scroll;-webkit-overflow-scrolling:touch;height:100vh }.widerWidth {min-height:1000px;perspective:300px;}.el {-webkit-transform:rotateX(80deg);transform:rotateX(80deg);}


The shared snippet does not work on Mozilla Firefox as well. Below is the solution tested for iOS Safari/Chrome (iPhone-6S), Windows Mozilla/Chrome:

no need to use -webkit-overflow-scrolling. There could be a possible bug for this feature as it is under development [Reference Link]. Removing this property generates the desired behavior. It might not be the exact solution, but it can act as a workaround.

.scroll {perspective:300px;overflow-y:scroll;height:100vh;}.el {-webkit-transform:rotateX(80deg);transform:rotateX(80deg);}

Codepen: http://codepen.io/anon/pen/LxZZdX