当鼠标悬停在它上面时,Bootstrap Carousel自动功能无法正常工作?

时间:2017-11-01 20:48:23

标签: javascript jquery html css twitter-bootstrap

当我的鼠标悬停在旋转木马上时,我的自举旋转木马不会改变幻灯片,并且为什么这么说。我有这个旋转木马在我的主页背景中播放,所以当鼠标徘徊失败时它不会移动它的目的。我已经包含了一个小提琴和所有相关的代码,我真的希望你们都能提供帮助,因为这真的很奇怪。

https://jsfiddle.net/DTcHh/38996/

HTML:

<div id="carouselHacked" class="carousel slide carousel-fade" data-ride="carousel">
        <ol class="carousel-indicators">
            <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
            <li data-target="#myCarousel" data-slide-to="3"></li>
            <li data-target="#myCarousel" data-slide-to="4"></li>
            <li data-target="#myCarousel" data-slide-to="5"></li>
            <li data-target="#myCarousel" data-slide-to="6"></li>
            <li data-target="#myCarousel" data-slide-to="7"></li>
        </ol>
        <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <div class="item active">
                <img src="https://i.imgur.com/qOho4rH.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/lSfzjbt.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/Xy8EhyE.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/A3FaoSG.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/wMcHybE.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/vadYihW.jpg" alt="">
            </div>
            <div class="item">
                <img src="https://i.imgur.com/EaSLrXs.jpg" alt="">
            </div>
        </div>

        <!-- Controls -->
        <a class="left carousel-control" href="#carouselHacked" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left prev" aria-hidden="true"></span>
            <span class="sr-only">Previous</span>
        </a>
        <a class="right carousel-control" href="#carouselHacked" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right next" aria-hidden="true"></span>
            <span class="sr-only">Next</span>
        </a>
    </div>

CSS:

body{
    margin:0;
    overflow-x: hidden;
    font-family: Calibri;
    font-style: normal;
    font-variant: normal;

}
.carousel-fade .carousel-inner .item {
  opacity: 0;
  transition-property: opacity;
}

.carousel-fade .carousel-inner .active {
  opacity: 1;
}

.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
  left: 0;
  opacity: 0;
  z-index: 1;
}

.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
  opacity: 1;
}

.carousel-fade .carousel-control {
  z-index: 2;
}

/*
  WHAT IS NEW IN 3.3: "Added transforms to improve carousel performance in modern browsers."
  Need to override the 3.3 new styles for modern browsers & apply opacity
*/
@media all and (transform-3d), (-webkit-transform-3d) {
    .carousel-fade .carousel-inner > .item.next,
    .carousel-fade .carousel-inner > .item.active.right {
      opacity: 0;
      -webkit-transform: translate3d(0, 0, 0);
              transform: translate3d(0, 0, 0);
    }
    .carousel-fade .carousel-inner > .item.prev,
    .carousel-fade .carousel-inner > .item.active.left {
      opacity: 0;
      -webkit-transform: translate3d(0, 0, 0);
              transform: translate3d(0, 0, 0);
    }
    .carousel-fade .carousel-inner > .item.next.left,
    .carousel-fade .carousel-inner > .item.prev.right,
    .carousel-fade .carousel-inner > .item.active {
      opacity: 1;
      -webkit-transform: translate3d(0, 0, 0);
              transform: translate3d(0, 0, 0);
    }
}

1 个答案:

答案 0 :(得分:0)

这是引导程序轮播的默认行为。在documentation

中查看他们的选项

设置{{ form_row(form.nomComp) }}以禁用此行为。

<强>例如:

data-pause="null"