html - 将 z-index 应用于定制的 js 轮播插件

标签 html css z-index css-transforms bespoke.js

我正在尝试使用 bespoke.js 实现轮播。我的代码笔的链接是 Link .

How do I apply z-index to the slides, which are not in focus? 
If I do z-index:1, then the whole orientation changes so, What should be done ?

最佳答案

这是你想要的吗?这允许接下来的两个 img 显示 opacity: 1.bespoke-active + .bespoke-inactive 会选择Active之后的第一个inactive img

.bespoke-active + .bespoke-inactive + .bespoke-inactive 将选择 Active 之后的第二个非事件 img:

.bespoke-active + .bespoke-inactive,
.bespoke-active + .bespoke-inactive + .bespoke-inactive{
   opacity: 1;
}

链接:https://codepen.io/hdl881127/pen/jmKpMB

更新:更好的方法:

由于您的 js 库会将这些类添加到您的部分(img 容器),您可以使用它们来定位 Active 之前的 img 和 Active 之后的 img:

.bespoke-before-1,
.bespoke-before-2,
.bespoke-after-1,
.bespoke-after-2 {
  opacity: 1;
}

链接:https://codepen.io/hdl881127/pen/QvxBxM

关于html - 将 z-index 应用于定制的 js 轮播插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43975010/

相关文章:

html - Bootstrap hero-unit 没有出现在网络上,可能是 z-index 错误

html - 使用 div 来对齐表单而不是表格有什么好处?

css - Bootstrap 网格 : vertical placement of multiple divs in a row?

javascript - 图像仅在 iPhone 上溢出到 div 之外

html - :last-child on a list item Menu 问题

html - 同一行上的图标很棒

html - 在绝对 div 中使用 Z-index 和定位文本来创建水印

javascript float 侧边栏z-index

android - 我可以将使用 Ratchet 构建的应用程序提交到应用程序商店和 Google Play 商店吗?

html - 防止 css 覆盖加载到 div 中的内容