1
votes

My bootstrap carousel won't change slides when my mouse is hovering over the carousel, and idk why. I have this carousel playing in the background of my home page so it not moving when the mouse hovers kind of defeats it's purpose. I've included a fiddle and all relevant code, I really hope y'all can help because this is really weird.

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

1 Answers

1
votes

This is the default behaviour of the bootstrap carousel. Look at their options in the documentation

Set data-pause="null" to disable this behaviour.

ex:

<div id="carouselHacked" class="carousel slide carousel-fade" data-ride="carousel" data-pause="null">