我在xampp中尝试了this codepen,但没有成功。
我的html代码:
<html>
<head>
<link type="text/css" href="./Products/style.css" rel="stylesheet" /></link>
</head>
<body>
<div class="container">
<section>
<div class="image" data-type="background" data-speed="2"></div>
<div class="stuff" data-type="content"><h1>Simple Parallax scroll</h1><h2>Reoptimized</h2></div>
</section>
<section>
<div class="image" data-type="background" data-speed="7"></div>
<div class="stuff" data-type="content"><h2>Made to be fast</h2><p>Lorem Deserunt maiores minima ipsa. Adipisci, corrupti, voluptatibus! Similique quidem necessitatibus provident.</p></div>
</section>
<section>
<div class="image" data-type="background" data-speed="6"></div>
<div class="stuff" data-type="content">Accusamus at ex amet perferendis atque fuga, ad earum, ipsa perspiciatis, dolore neque, accusantium consectetur quis voluptatibus culpa architecto animi natus facere expedita sed. Voluptatem odit explicabo amet neque aut.</div>
</section>
<section>
<div class="image" data-type="background" data-speed="5"></div>
<div class="stuff" data-type="content">Accusamus at ex amet perferendis atque fuga, ad earum, ipsa perspiciatis, dolore neque, accusantium consectetur quis voluptatibus culpa architecto animi natus facere expedita sed. Voluptatem odit explicabo amet neque aut.</div>
</section>
<section>
<div class="image" data-type="background" data-speed="3"></div>
<div class="stuff" data-type="content">Accusamus at ex amet perferendis atque fuga, ad earum, ipsa perspiciatis, dolore neque, accusantium consectetur quis voluptatibus culpa architecto animi natus facere expedita sed. Voluptatem odit explicabo amet neque aut.</div>
</section>
<section>
<div class="image" data-type="background" data-speed="3"></div>
<div class="stuff" data-type="content">Accusamus at ex amet perferendis atque fuga, ad earum, ipsa perspiciatis, dolore neque, accusantium consectetur quis voluptatibus culpa architecto animi natus facere expedita sed. Voluptatem odit explicabo amet neque aut.</div>
</section>
</div>
<script src="./Products/js.js"></script>
</body>
<html>
最佳答案
关于javascript - 视差图像未出现在Google Chrome中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54090554/