我想将此幻灯片轮播用于响应图像(img流体)。
所以一切正常,但是在页面加载时需要几秒钟才能显示幻灯片。比幻灯片下面的内容跳下来,这还不是那么漂亮。
为防止这种“突出”,我必须做些什么。在响应高度的情况下,我所知道的一切都无法设置为(id =“ imgslider”)的高度或最小高度!
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<div id="imgslider" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#imgslider" data-slide-to="0" class="active"></li>
<li data-target="#imgslider" data-slide-to="1"></li>
<li data-target="#imgslider" data-slide-to="2"></li>
</ol>
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img class="d-block img-fluid" src="https://via.placeholder.com/1920x620" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h1>hi</h1>
<p>my text</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="https://via.placeholder.com/1920x620 " alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h1>hi</h1>
<p>my text</p>
</div>
</div>
<div class="carousel-item">
<img class="d-block img-fluid" src="https://via.placeholder.com/1920x620" alt="First slide">
<div class="carousel-caption d-none d-md-block">
<h1>hi</h1>
<p>my text</p>
</div>
</div>
<a class="carousel-control-prev" href="#imgslider" role="button" data-slide="prev">
<span><i class="fa fa-angle-left" aria-hidden="true"></i></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#imgslider" role="button" data-slide="next">
<span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div>my other content</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
在此摘录中,您可能看不到跳跃,因为占位符是轻量级的,因此幻灯片将正确加载,显示和开始。
我是否必须创建一种响应式加载微调器-但我不知道如何-或在最佳情况下,有一种更简单的方法来解决它?
非常感谢您的帮助。