仅在悬停时制作Bootstrap Carousel导航

时间:2022-11-03 21:31:35

I was using Bootstrap's Carousel, found here. It's a great script, unfortunately, I'd like for it to be able for the navigation arrows to go away and only appear on hover. Is this possible and how would I would go about implementing that?

我在这里使用Bootstrap的Carousel。不幸的是,这是一个很棒的剧本,我希望它能够使导航箭头消失并且仅在悬停时出现。这是可能的,我将如何实现这一点?

Thanks for all help!

谢谢大家的帮助!

2 个解决方案

#1


46  

You just need a little bit of CSS

你只需要一点CSS

.carousel .carousel-control { visibility: hidden; }
.carousel:hover .carousel-control { visibility: visible; }

Demo (jsfiddle)

演示(jsfiddle)

#2


0  

Its also nice to get rid of those pesky gradients, which adding this also does:

它也很好摆脱那些讨厌的渐变,添加这也是:

.carousel-control.left, .carousel-control.right {
  background: none !important;
  filter: progid: none !important;
  outline: 0;
}
.carousel .carousel-control {
  visibility: hidden;
}
.carousel:hover .carousel-control {
  visibility: visible;
}

#1


46  

You just need a little bit of CSS

你只需要一点CSS

.carousel .carousel-control { visibility: hidden; }
.carousel:hover .carousel-control { visibility: visible; }

Demo (jsfiddle)

演示(jsfiddle)

#2


0  

Its also nice to get rid of those pesky gradients, which adding this also does:

它也很好摆脱那些讨厌的渐变,添加这也是:

.carousel-control.left, .carousel-control.right {
  background: none !important;
  filter: progid: none !important;
  outline: 0;
}
.carousel .carousel-control {
  visibility: hidden;
}
.carousel:hover .carousel-control {
  visibility: visible;
}