好吧,所以這在過去兩天一直讓我感到非常痛苦和悲傷,我終於縮小了問題的範圍,但絕不接近解決它的問題。奇怪!doctype bug與視差插件'skrollr'
我在使用Skrollr插件構建視差網站。只要出現<!doctype html>
,該插件就會停止在我的文檔中運行。
我創建了一個新的簡單示例,它仍然產生相同的錯誤。
奇怪的是,在他們自己的網站上,他們宣佈與我一樣的<!doctype html>
,但它在那裏工作。
我的代碼:
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
.section1{
height:1000px;
background:gray;
}
.section1 img {
width:2000px;
height:1000px;
}
.section2{
width:2000px;
height:1000px;
background:url('background2.jpg');
position: absolute;
}
.section3{
width:2000px;
height:1000px;
background:url('background3.jpg');
}
</style>
</head>
<body>
<section class="section1">
<div style="position:absolute; background:url('background1.jpg') no-repeat; width:100%; height:1000px; background-size:cover;" data-0="top:0;" data-1200="top:350px;"></div>
</section>
<section class="section2"></section>
<section class="section3"></section>
<script src="skrollr.min.js"></script>
<script>
var s = skrollr.init({
edgeStrategy: 'set',
easing: {
WTF: Math.random,
inverted: function(p) {
return 1-p;
}
}
});
</script>
</body>
</html>
在哪個瀏覽器中無法正常工作?如果它是IE添加到你的頭上,這樣IE就知道要正確渲染(不是在怪癖模式下) –
對不起,這不是在任何瀏覽器中工作。我目前正在Chrome中開發。 –
您應該詳細說明「不工作」是否在開發人員控制檯(F12)中看到任何錯誤?它是完全運作還是完全死亡? –