iOS5 Images disappear when scrolling with webkit-overflow-scrolling: touch

老子叫甜甜 提交于 2019-11-27 07:38:37
Mark Napthine

I have had the same problem in the past, if you need to use positioned elements try adding -webkit-transform: translateZ(0); to the elements or the container. This property often forces the browser to use hardware acceleration and with the extra power your images will most likely not disappear. It worked for me anyway.

More useful stuff here too: http://www.html5rocks.com/en/tutorials/speed/html5/

We tracked this down to elements that had position:relative or position:absolute. After we removed them the items would display while scrolling.

Like Mark Napthine said, adding the following css definition:

-webkit-transform: translateZ(0);

should indeed force rendering. The trick is to put it on every unrendered element inside your overflowing container. In my case it's an unordered list of images contained in a div with the def

-webkit-overflow-scrolling: touch;

I put the "transform" definition above on the li tags wrapping the images and it solved the problem instantly. Hope this helps...

Ashish

This is a bug that I've run across too - this question seems to relate to the same issue: CSS3 property webkit-overflow-scrolling:touch ERROR

There user1012566 suggested it has to do with the position property of the elements inside the scroll (static works, nothing else does), though I had mixed results with this.

Another user said they've reported it on the bugreport.apple.com site, but reported bugs aren't public there, so it's impossible for the rest of us to see the official response, if any, or track progress.

This bug seems even worse with iFrames. I created a JSFIDDLE to demonstrate it (open http://jsfiddle.net/KMayN/9/ with an iOS 5.0.1 device) and I sent a bug report to Apple. Very curious: if you scroll, you'll see a blank (not rendered) content...but if you then zoom, the content appears! And so on... I will keep you up-to-date if they reply to me. I tried everything (scrollable iFrame with/without div container, container with/without scrolling, etc...), there are simply no way: we have to wait Apple for a bugfix.

-webkit-transform: translate3d(0, 0, 0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!