关于antd Carousel的样式更改

显示左右箭头

<Carousel autoplay={true}  arrows={true} prevArrow={<h1>123</h1>} nextArrow={<h1>123</h1>}>
                <div>
                    <h3 style={contentStyle}>1</h3>
                </div>
                <div>
                    <h3 style={contentStyle}>2</h3>
                </div>
                <div>
                    <h3 style={contentStyle}>3</h3>
                </div>
                <div>
                    <h3 style={contentStyle}>4</h3>
                </div>
            </Carousel>
.ant-carousel .slick-prev,

.ant-carousel .slick-next,

.ant-carousel .slick-prev:hover,

.ant-carousel .slick-next:hover {

  font-size: inherit;

  color: currentColor;

}



.ant-carousel .slick-prev,

.ant-carousel .slick-prev:hover {

  left: 10px;

  z-index: 2;

  color: white;

}



.ant-carousel .slick-next,

.ant-carousel .slick-next:hover {

  right: 10px;

  z-index: 2;

  color: white;

}

修改指示点为圆点

.slick-dots li button {
  width: 10px !important ;
  height: 10px !important;
  background: rgb(163, 38, 217) !important;
  border-radius: 100% !important;
}
.slick-dots li {
  width: 23px !important ;
}
.slick-dots li.slick-active {
  width: 23px !important ;
}
.ant-carousel .slick-dots-bottom{
  /*bottom: -12% !important;*/
}

设置开始图片

 <Carousel
        autoplay
        arrows={true}
        //设置开始图片
        initialSlide={index}
        effect={"vertical"}
        autoplaySpeed={8000}
        prevArrow={<h1>123</h1>}
        nextArrow={<h1>123</h1>}
      >
        <div>
          <h3 style={contentStyle}>21</h3>
        </div>
        <div>
          <h3 style={contentStyle}>2</h3>
        </div>
        <div>
          <h3 style={contentStyle}>3</h3>
        </div>
        <div>
          <h3 style={contentStyle}>4</h3>
        </div>
      </Carousel>

修改切换方向

可以通过直接修改dotPosition实现

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值