Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
617 views
in Technique[技术] by (71.8m points)

ios - Is there a workaround for bug in Mobile Safari: Pinch to Zoom results in random scrolling blockage?

I have an image in a scrolling div:

<div style="
    width:600px;height:400px;
    overflow:scroll;
    position:relative;
    top:0;left:0;
    -webkit-overflow-scrolling: touch;">

    <img src=image.jpg width=2000 height=2000>
</div>

It works everywhere as expected, except that on iOS (8.1.3), when I zoom in using my fingers, the DIV stops scrolling correctly.

One can still scroll to a certain point, but it is impossible to view the entire image except when it's barely zoomed at all.

I have tried hundreds of combinations of fixed, absolute & relative positioning on the body, the div and the image, and also various combinations of overflow:fixed etc. None of it works.

If I remove "-webkit-overflow-scrolling: touch;", the problem goes away but scrolling loses momentum and becomes painful.

The scrolling behavior seems pretty random. Sometimes you can scroll up, sometimes not. The problem seems to come from a conflict between the viewport scrolling and the image scrolling.

I posted a simple example at tech.ozake.com.

Is there any way to make the image smoothly scrollable when one zooms in on it?

[update 23 may 2017] This may be fixed in the next version of Mobile Safari: news.ycombinator.com.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...