Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

javascript - iOS: Multiple divs with -webkit-backface-visibility:hidden crash browser when zooming

When I view the following html page on my iPad 4 browser (doesn't matter whether Safari or Chrome), the browser crashes when zooming (either on double tap zoom or pinch to zoom). The page contains 40 simple divs (which are inserted by javascript for brevity) having the property -webkit-backface-visibility:hidden.

<!doctype html>
<html>
<head>
    <style>
        .front {
            -webkit-backface-visibility: hidden;
            position: absolute;
            border: 1px solid black;
            width: 800px;
            height: 800px;
        }
    </style>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>    
</head>

<body id="outer">
    <script>
        $(function() {
            for (var i = 0; i < 40; i++) {
                $(document.createElement('div'))
                    .css({top: i*10, left: i*10})
                    .addClass("front").appendTo($("#outer"));
            }
        })
    </script>
</body>
</html>

The same problem presumably also occurs on iPhone and older iPads. This is a weird and annoying bug; it does not happen when I deactivate the -webkit-backface-visibility:hidden style of the inner elements.

You may ask: why do I not simply remove the -webkit-backface-visibility:hidden style as it does not make any difference on this page? Well, this is a minimal counterexample, I need it on the actual, more complex page.

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

It seems that mobile Safari has some troubles with css3 properties like transitions, transform or backface-visiblity and runs sometimes out of memory.

See:

But unfortunately there are no known workarounds, except of removing the property... How did you solve your problem?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...