对于我的网站,我制作了一个引导轮播,其中有不同的幻灯片,每个幻灯片都有视差效果。
JSFiddle
<!--Carousel Wrapper-->
<div id="carousel-example-2" class="carousel slide carousel-fade" data-ride="carousel">
<!--Indicators-->
<ol class="carousel-indicators">
<li data-target="#carousel-example-2" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-2" data-slide-to="1"></li>
<li data-target="#carousel-example-2" data-slide-to="2"></li>
</ol>
<!--/.Indicators-->
<!--Slides-->
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<div class="view slidescss" style="background:url('https://mdbootstrap.com/img/Photos/Slides/img%20(68).jpg')no-repeat fixed center;">
<div class="mask rgba-black-light"></div>
</div>
<div class="carousel-caption">
<h3 class="h3-responsive">Light mask</h3>
<p>First text</p>
</div>
</div>
<div class="carousel-item">
<!--Mask color-->
<div class="view slidescss" style="background:url('https://mdbootstrap.com/img/Photos/Slides/img%20(6).jpg')no-repeat fixed center;">
<div class="mask rgba-black-light"></div>
</div>
<div class="carousel-caption">
<h3 class="h3-responsive">Strong mask</h3>
<p>Secondary text</p>
</div>
</div>
<div class="carousel-item">
<!--Mask color-->
<div class="view slidescss" style="background:url('https://mdbootstrap.com/img/Photos/Slides/img%20(9).jpg')no-repeat fixed center;">
<div class="mask rgba-black-light"></div>
</div>
<div class="carousel-caption">
<h3 class="h3-responsive">Slight mask</h3>
<p>Third text</p>
</div>
</div>
</div>
<!--/.Slides-->
<!--Controls-->
<a class="carousel-control-prev" href="#carousel-example-2" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#carousel-example-2" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
自己的CSS类:
.slidescss{
background-size:1920px 1080px;
width:100%;
min-height:800px;
}
在任何浏览器中,然后在Firefox中尝试此操作。
在Firefox中,标题位于图像上方,背景为白色或灰色。它将图像向下推。我通过从
center
删除background:url()
属性来解决此问题。但是它仍然没有视差效果。 最佳答案
与之冲突
-webkit-transform: translate3d(0,0,0);
您可以删除它,然后它将起作用。
https://jsfiddle.net/aq9Laaew/16131/
亲切的问候,
拉科乌
关于html - 引导轮播上的视差效果在Firefox中不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49936183/