简体   繁体   English

如何仅在第二张幻灯片上更改轮播图像滑块指示符(箭头)的颜色?

[英]How to change carousel image slider indicators(arrows) color only on the second slide?

how can i change the carousel image slider indicator arrows only on the second image slide??? 我如何仅在第二张图像幻灯片上更改轮播图像滑块指示符箭头???

On the first slide i want to be black color, but when the image slide to 2nd slide i want to set the indicators to white color. 在第一张幻灯片上,我希望是黑色,但是当图像幻灯片到第二张幻灯片时,我想将指示器设置为白色。

Is this possible??? 这可能吗???

I tried to create id tag on second slide, but its not helped, someone who is expert in CSS know how to do this??? 我试图在第二张幻灯片上创建id标签,但没有帮助,CSS方面的专家知道该怎么做?

The big problem is i can't target in CSS only the second slide carousel icons,and i don't know how to do this. 最大的问题是我不能只在CSS中定位第二张幻灯片轮播图标,而且我也不知道该怎么做。

Here is the HTML code,this is the Carousel image slider sample: 这是HTML代码,这是“轮播”图片滑块示例:

<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>

And i want to target the second image slider arrow icon in CSS to set the arrow color to white. 我想在CSS中定位第二个图像滑块箭头图标,以将箭头颜色设置为白色。 carousel-control-next, .carousel-control-prev 轮播控制下一个,.carousel-control-prev

没有看到您的代码,我不确定,但是您应该能够使用这样的nth-child选择器:.target:nth-​​child(2){//这里的样式}有关nth-child选择器的更多信息,您可以检查在W3 Schools上发布此文章: https : //www.w3schools.com/cssref/sel_nth-child.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM