我做了一个项目,但发现视差滚动是有缺口的,不像在Chrome上那么平滑。 目前,我也创建了一个专业的网站,所以想要解决这个问题。 感谢您提前将HTML
<div class="container"> <div class="row"> <div class="col-lg-12"> <h1>Holidays 4 You</h1> <h3> The Best Holiday Finder Out There</h3> <hr> <button class="btn btn-success btn-lg"><a href="form.html">Get Started!</a></button> </div> </div> </div> </div> <div class="parallax">
css为:
#content {
text-align: center;
padding-top: 25%;
text-shadow: 0px 4px 3px rgba(0,0,0,0.4),
0px 8px 13px rgba(0,0,0,0.1),
0px 18px 23px rgba(0,0,0,0.1);
background-image: url("https://images.unsplash.com/photo-1496046744122-2328018d60b6?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1528&q=80");
min-height: 850px;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: top;
background-repeat: no-repeat;
background-size: cover;
}
.parallax {
background-color: white;
/* Set a specific height */
min-height: 665px;
}
检查你的网站上的图片是否是JPG,也许它们是大的,这就是为什么preformance issue尝试使用SVG或PNG