html - MDB Bootstrap 轮播指示器改变位置
问题描述
我目前正在一个使用 MDB 引导程序的所有组件的站点上工作。我一直在研究一个轮播,其中包含根据被点击的指示器左右移动的卡片。
轮播部分的代码如下:
<div style="align-items:center" class="carousel-container">
<div id="carousel-example-multi" class="carousel slide carousel-multi-item v-2" data-ride="carousel">
<!--Controls-->
<div class="controls-top">
<a class="btn-floating" href="#carousel-example-multi" data-slide="prev">
<i class="fas fa-chevron-left"></i>
</a>
<a class="btn-floating" href="#carousel-example-multi" data-slide="next">
<i class="fas fa-chevron-right"></i>
</a>
</div>
<!--/.Controls-->
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-multi" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-multi" data-slide-to="1"></li>
<li data-target="#carousel-example-multi" data-slide-to="2"></li>
<li data-target="#carousel-example-multi" data-slide-to="3"></li>
</ol>
<!--/.Indicators-->
<!--carrosellll-->
<div class="carousel-inner v-2" role="listbox">
<div class="carousel-item active">
<div class="card-body">
<h4 class="card-title font-weight-bold">Random Name</h4>
<h6 class="card-title">Position</h6>
<p class="card-text">
Based in London, UK<br><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
</p>
</div>
</div>
<div class="carousel-item">
<div class="card-body">
<h4 class="card-title font-weight-bold">Random Name</h4>
<h6 class="card-title">Position</h6>
<p class="card-text">
Based in Calgary, Canada.<br><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.
</p>
</div>
</div>
<div class="carousel-item">
<div class="card-body">
<h4 class="card-title font-weight-bold">Random Name</h4>
<h6 class="card-title">Position</h6>
<p class="card-text">
Based in Canary Islands, Spain.<br><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
</div>
</div>
<div class="carousel-item">
<div class="card-body">
<h4 class="card-title font-weight-bold">Random Name</h4>
<h6 class="card-title">Position</h6>
<p class="card-text">
Based in Bangkok, Thailand.<br><br>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. <br><br><br><br />
</p>
</div>
</div>
<a class="carousel-control-prev" href="#carousel-example-multi" 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-multi" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
<br /><br /><br />
</div>
</div>
下面是旋转木马在处理时的样子的简短 gif。
(我知道错误是由不同大小的文本改变卡片大小引起的,但我不确定如何将其设为固定大小或将指示设为固定位置)
解决方案
即使它不专业,我发现在所有轮播项目中插入文本(标题,段落 - 取决于您的轮播包含的内容)以匹配轮播的最长卡片和将可见性设置为隐藏而不是使用中断。
<h1 class = "card-title-text" style = "visibility: hidden">Lorem ipsum dolor sit amet</h1>
<p class = "card-text" style = "visibility: hidden"> discere platonem mediocritatem sea ne, sea ut velit democritum elaboraret. Posse conceptam ea per. Vivendum legendos inimicus pri id, ut eos consulatu pertinacia moderatius.</p>
推荐阅读
- javascript - 调用 javascript 函数时未捕获的引用错误
- python - numpy - how to slice of an array passed the limit of the array and back to the beginning
- vue.js - IdentityServer4 的 idsrv cookie 中将存储哪些数据?
- android - 从源 tflite 模型构建的 tensorflow-lite-select-tf-ops 和 tensorflow-lite AAR 找不到 org.tensorflow.lite.Interpreter
- karate - 我如何将响应状态从空手道中的另一个功能文件读取到功能文件中
- sql - 在表中搜索相反的值
- javascript - 为什么 alertify 确认取消按钮不起作用?
- agora.io - Agora 云录制未将视频保存到 S3
- c# - XmlInclude 在 Unii 测试项目中
- node.js - “primordials; ^ ReferenceError: primordials is not defined” 使用 gulp 4.0.2 和节点版本 11.15.0