javascript - 在 swiper js 中更改幻灯片时隐藏元素
问题描述
我在页面上使用 Swiper js 制作幻灯片。每张幻灯片都有另一个图像元素位于幻灯片图像内部和一部分外部。因此,每当幻灯片更改时,可以看到幻灯片外部的部分。
我尝试overflow: hidden
用于不同类别的 swiper js,但没有奏效。
这是您可以检查滑块的链接:https ://project-instock.netlify.app/index1.html#0
解决方案
我通过添加来做到这一点fadeEffect: { crossFade: true, }
。
最初,脚本是
var swiper = new Swiper('.mySwiper5', {
effect: 'fade',
centeredSlides: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
autoplay: {
delay: 7000,
disableOnInteraction: false,
},
});
其中启用了淡入淡出效果,但没有提到淡入淡出的那种。
推荐阅读
- python - 调用使用 StringVar() 重构的现有变量(列表)
- wordpress - Kubernetes Mariadb 服务无法访问
- excel - 你可以创建一个 PDF 并有一个目标路径,如下所示?
- swiftui - SwiftUI/Combine 发布者是双向的吗?
- python - 对 QTableWidget 和 QListWidget 使用相同的子类覆盖方法
- python - 如何搜索 if 语句中的不同字符串中是否存在 2 组字符串?
- javascript - 如何让我的 fetch 在 React 组件中只被调用一次?
- .net - 关于 .NET TargetFrameworks 的建议
- ios - FireFox 或 IOS 上又大又丑的播放按钮
- python - Extract dictionaries from HTML scraped text