javascript - 如何仅在第二张幻灯片上更改轮播图像 slider 指示器(箭头)颜色?

标签 javascript html css

如何仅在第二张图片幻灯片上更改轮播图片 slider 指示器箭头???

在第一张幻灯片上,我想将指示器设置为黑色,但是当图像滑到第二张幻灯片时,我想将指示器设置为白色。

这可能吗???

我试图在第二张幻灯片上创建 id 标签,但没有帮助,CSS 专家知道该怎么做吗???

最大的问题是我无法在 CSS 中仅定位第二张幻灯片轮播图标,而且我不知道该怎么做。

最佳答案

这是 HTML 代码,这是 Carousel 图像 slider 示例:

<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>


  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="1.jpg"   alt="First slide">
      <div class="carousel-caption">
      <h2 id="fadeuptext" class='animated fadeInUp' style="animation-delay: 1s">Hello</h2>
      <h2 id="fadelefttext" class='animated fadeInLeft' style="animation-delay: 2s">World</h2>

      </div>
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="2.jpg" style="height:797px;"   alt="Second slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="3.jpg" style="height:797px;"   alt="Third slide">
    </div>
  </div>


  <a class="carousel-control-prev" href="#carouselExampleIndicators" 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="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

我想将 CSS 中的第二个图像 slider 箭头图标作为目标,将箭头颜色设置为白色。 旋转木马控制下一个,.旋转木马控制上一个

关于javascript - 如何仅在第二张幻灯片上更改轮播图像 slider 指示器(箭头)颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56224829/

相关文章:

javascript - 添加脚本引用后 HTML 不显示

html - div 中的文本出现在正确的位置,但它的设计元素没有

php - 单击提交时 Codeigniter 无法更新表单

javascript - 保持类(class)活跃,直到里面的最后一个类活跃

Javascript:多个过滤器和多个 div

javascript - 使不安全的图像源成为安全的客户端

html - 如何在页面上水平居中 div 的同时水平居中 div 中的图像?

javascript - 使用 jQuery 数据检测事件幻灯片并运行函数

jquery - 具有响应式设计的粘性标题

jquery - 单击具有相对位置的 div