javascript - img画廊的自动滚动缩略图
问题描述
我想做一堆我在页面上自动滚动的图像。我环顾四周,但似乎无法找到正确的答案来做到这一点。我不认为轮播是我正在寻找的……答案可能在于 Jquery 或 JavaScript,尽管我不确定。
布局:
所以,假设我还有 10 张图像,我怎样才能将它们添加到这一行以使它们在屏幕上滚动?
img 画廊 html:
<div style="background-color: #54c545;">
<div class="container">
<!-- Grid row-->
<div class="row py-4 d-flex align-items-center">
<div class="container">
<h2>Image Gallery</h2>
<div class="row">
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoContin.png" alt="Lights" style="width:100%">
</div>
</div>
<!-- end col -->
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoAns.png" alt="Nature" style="width:100%">
</div>
</div>
<!-- end col -->
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoAns.png" alt="Nature" style="width:100%">
</div>
</div>
<!-- end col -->
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoAns.png" alt="Nature" style="width:100%">
</div>
</div>
<!-- end col -->
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoAns.png" alt="Nature" style="width:100%">
</div>
</div>
<!-- end col -->
<div class="col-md-2">
<div class="thumbnail">
<img src="img/holoAns.png" alt="Nature" style="width:100%">
</div>
</div>
<!-- end col -->
</div>
</div>
</div>
<!-- Grid row-->
</div>
<!-- end img gallery container -->
</div>
解决方案
为什么不轮播:https ://owlcarousel2.github.io/OwlCarousel2/ ????
您可以将另外 10 个客户端图像放在 a 内<a>
或直接在 a 下<div>
,并使用插件对其进行初始化。在小提琴示例中,我使用了图标。
jsfiddle:http: //jsfiddle.net/aq9Laaew/125272/
由于您在 OP 中没有解释太多,因此我也没有对如何使用 OwlCarousel 插件进行太多解释。请阅读他们的文档。
推荐阅读
- c# - c# if语句,switch语句
- python - 在熊猫中按降序对数据进行排序
- java - 在 picocli 中实现交互式确认
- react-native - 使用矢量图标时的 EXPO 错误和警告
- android - 如何从 DAO 获取 OnConflictStrategy 返回值
- wordpress - Custom Nav Walker 检查菜单子项是否有子项
- python - 在 python 中解析 Json 文件并在对话框流中打印响应
- c# - 如何使用 AutoMapper 将 3 个对象映射到视图模型
- amazon-web-services - 从 s3a 存储桶中检索最新的对象版本
- python - 如何从 python 中的多个光栅文件创建 netcdf 文件?