Javascript 使 Bootstrap Carousel 导航仅在悬停时显示
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11919656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Make Bootstrap Carousel navigation show only on hover
提问by Muhambi
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!
感谢所有帮助!
回答by Sherbrow
You just need a little bit of CSS
你只需要一点 CSS
.carousel .carousel-control { visibility: hidden; }
.carousel:hover .carousel-control { visibility: visible; }
回答by Tyhou
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;
}