iOS 7 中的网页崩溃
Posted
技术标签:
【中文标题】iOS 7 中的网页崩溃【英文标题】:Web page crashes in iOS 7 【发布时间】:2015-02-12 08:44:31 【问题描述】:更新:我想通了。 ios 7 不喜欢 vh 单位。所以我改用 javascript 来检测浏览器高度,现在它可以在 iOS 7 上运行。
我创建了一个网站,该网站可以在我测试过的所有设备上运行,除了装有 iOS 7 的 iPhone。整个页面崩溃了,并且做这种疯狂的迪斯科闪烁的事情。
iOS 7 上的结果可以在这里看到:http://morten-hauge.com/diverse/ios7_fail.MOV
如果我删除我的 CSS 文件,页面会按照您对没有 CSS 的页面的预期加载。
*
margin: 0;
padding: 0;
a, a img
text-decoration: none;
border-style: none;
#splash-container
position: fixed;
top: 40px;
right: 40px;
-webkit-backface-visibility: hidden;
img.splash
display: block;
width: 100px;
height: 100px;
margin: 0 0 20px 0;
transition-duration: .2s, .2s;
transition-timing-function: linear, ease-in;
-ms-transition-duration: .2s, .2s;
-ms-transition-timing-function: linear, ease-in;
-webkit-transition-duration: .2s, .2s;
-webkit-transition-timing-function: linear, ease-in;
-o-transition-duration: .2s, .2s;
-o-transition-timing-function: linear, ease-in;
-moz-transition-duration: .2s, .2s;
-moz-transition-timing-function: linear, ease-in;
img.splash:hover
transform: scale(1.1);
-ms-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
-moz-transform: scale(1.1);
cursor: pointer;
#splash1-mobil
display: none;
.pil
width: 40px;
height: 40px;
margin: 160px auto 0 auto;
padding: 0;
position: relative;
animation: arrowAni 1.5s ease-in-out infinite;
-webkit-animation: arrowAni 1.5s ease-in-out infinite;
-moz-animation: arrowAni 1.5s ease-in-out infinite;
-o-animation: arrowAni 1.5s ease-in-out infinite;
-ms-animation: arrowAni 1.5s ease-in-out infinite;
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
img.pil
-webkit-backface-visibility: hidden;
a img.pil
-webkit-backface-visibility: hidden;
@keyframes arrowAni
0% bottom: 10px;
50% bottom: 30px;
100% bottom: 10px;
@-webkit-keyframes arrowAni
0% bottom: 10px;
50% bottom: 30px;
100% bottom: 10px;
@-moz-keyframes arrowAni
0% bottom: 10px;
50% bottom: 30px;
100% bottom: 10px;
@-o-keyframes arrowAni
0% bottom: 10px;
50% bottom: 30px;
100% bottom: 10px;
@-ms-keyframes arrowAni
0% bottom: 10px;
50% bottom: 30px;
100% bottom: 10px;
.section
width: 100%;
height: 80vh;
padding: 30vh 0 50px 0;
text-align: center;
.content
background: #FFF;
background: rgba(255,255,255,.8);
padding: 40px 40px 20px 40px;
width: 40%;
margin: 0 auto 0 auto;
text-align: center;
#intro
background: url('img/intro.jpg');
background-size: cover;
background-attachment: fixed;
span.handsome
font-family: 'Handsome';
text-transform: none;
font-size: 45px;
line-height: 10px;
margin: 0 0 0 0;
h1,h2
font-family: 'GarageGothic';
text-transform: uppercase;
font-weight: normal;
font-size: 60px;
h2
margin: 0 0 20px 0;
h3
font-family: 'GarageGothic';
text-transform: uppercase;
font-weight: normal;
font-size: 40px;
margin: 0 0 20px 0;
.content p
font-family: 'OpenSans';
margin: 0 0 30px 0;
font-size: 18px;
.button
font-family: 'GarageGothic';
font-size: 30px;
background: #e65a50;
padding: 5px 30px 5px 30px;
cursor: pointer;
margin: 20px;
-webkit-box-shadow: 5px 5px 0px #bfbfbf;
-moz-box-shadow: 5px 5px 0px #bfbfbf;
box-shadow: 5px 5px 0px #bfbfbf;
text-align: center;
color: #000;
.button:hover
background: #ff665b;
.button:active
background: #e65a50;
.button-clicked
background: #d4edb5;
cursor: default;
.button-clicked:hover
background: #d4edb5;
.disabled
opacity: .5;
background: #CCC;
cursor: default;
.disabled:hover
background: #CCC;
.button a, .button a:visited
color: #000;
text-decoration: none;
span.steps
font-family: 'OpenSans';
font-size: 10px;
margin: 40px 0 0 0;
display: block;
color: #7e7e7e;
ul#sticky
position: fixed;
top: 25px;
left: 25px;
ul#sticky li
font-family: 'OpenSans';
padding: 10px;
color: #000;
background: #FFF;
background: rgba(255,255,255,0.8);
border-bottom: 1px solid #FFF;
border-right: 1px solid #FFF;
border-left: 1px solid #FFF;
font-size: 12px;
list-style: none;
ul#sticky li:first-child
border-top: 1px solid #FFF;
background: #FFF;
background: rgba(255,255,255, .8);
font-family: 'GarageGothic';
text-transform: uppercase;
font-size: 20px;
text-align: center;
img.checkmark
width: 10px;
height: 10px;
margin: 0 3px 0 0;
#vann-section
background: url('img/vann.jpg');
background-size: cover;
background-attachment: fixed;
#ifboligsjekk-section
background: url('img/ifboligsjekk.jpg');
background-size: cover;
background-attachment: fixed;
#boligsjekk-splash
width: 80px;
height: 80px;
display: block;
left: 25%;
margin: -50px 0 0 0;
position: absolute;
transition-duration: .2s, .2s;
transition-timing-function: linear, ease-in;
-ms-transition-duration: .2s, .2s;
-ms-transition-timing-function: linear, ease-in;
-webkit-transition-duration: .2s, .2s;
-webkit-transition-timing-function: linear, ease-in;
-o-transition-duration: .2s, .2s;
-o-transition-timing-function: linear, ease-in;
-moz-transition-duration: .2s, .2s;
-moz-transition-timing-function: linear, ease-in;
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
#boligsjekk-splash:hover
transform: scale(1.1);
-ms-transform: scale(1.1);
-webkit-transform: scale(1.1);
-o-transform: scale(1.1);
-moz-transform: scale(1.1);
cursor: pointer;
#brannskader-section
background: url('img/brann.jpg');
background-size: cover;
background-attachment: fixed;
#handverker-section
background: url('img/håndverker.jpg');
background-size: cover;
background-attachment: fixed;
#sopp-section
background: url('img/sopp.jpg');
background-size: cover;
background-attachment: fixed;
#dyroginsekter-section
background: url('img/skadedyr.jpg');
background-size: cover;
background-attachment: fixed;
#leieinntekt-section
background: url('img/leieinntekt.jpg');
background-size: cover;
background-attachment: fixed;
#rettshjelp-section
background: url('img/rettshjelp.jpg');
background-size: cover;
background-attachment: fixed;
#tyveri-section
background: url('img/tyveri.jpg');
background-size: cover;
background-attachment: fixed;
#naturskade-section
background: url('img/naturskade.jpg');
background-size: cover;
background-attachment: fixed;
#resultat
width: 100%;
min-height: 80vh;
height: 100%;
padding: 30vh 0 50px 0;
text-align: center;
background: url('img/res.jpg');
background-size: cover;
background-attachment: fixed;
#resultat .content
padding: 40px;
#resultat p
line-height: 28px;
#resultat .button
display: inline-block;
font-size: 20px;
#button-ops-container
font-family: 'GarageGothic';
text-transform: uppercase;
font-size: 30px;
background: #e65a50;
padding: 5px 30px 5px 30px;
cursor: pointer;
margin: 20px;
-webkit-box-shadow: 5px 5px 0px #bfbfbf;
-moz-box-shadow: 5px 5px 0px #bfbfbf;
-o-box-shadow: 5px 5px 0px #bfbfbf;
-ms-box-shadow: 5px 5px 0px #bfbfbf;
box-shadow: 5px 5px 0px #bfbfbf;
text-align: center;
color: #000;
#button-ops-container:hover
background: #ff665b;
#button-ops-container:active
background: #e65a50;
#ops
color: #000;
text-decoration: none;
#ops:visited
color: #000;
【问题讨论】:
【参考方案1】:马上,我会尝试删除任何 CSS animation
、transform
和 perspective
,看看是否可以停止闪烁。如果不确切地知道脚本是做什么的,以及元素是如何分层的,很难说清楚。
【讨论】:
以上是关于iOS 7 中的网页崩溃的主要内容,如果未能解决你的问题,请参考以下文章