How can I change the sliding animation to fade in/out with transition on Bootstrap3 Carousel

后端 未结 2 1143
孤城傲影
孤城傲影 2020-12-08 05:24

I was trying to change the sliding effect of bootstrap 3 carousel to fade in/out. I followed the instruction given here Can the Twitter Bootstrap Carousel plugin fade in and

相关标签:
2条回答
  • 2020-12-08 06:01

    Try this carousel fade example. It will show you how to change opacity for prev and next buttons.

    .carousel-fade .carousel-inner .item {
      opacity: 0;
      -webkit-transition-property: opacity;
      -moz-transition-property: opacity;
      -o-transition-property: opacity;
      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;
    }
    

    http://bootply.com/86170

    0 讨论(0)
  • 2020-12-08 06:04

    Add class ".carousel-fade" in your carousel. css:

    .carousel-fade .active.left {
            left:0;
            opacity:0;
            -webkit-transition: opacity 1s; /*time < to $.carousel.interval setup */
            -moz-transition: opacity 1s; 
            -ms-transition: opacity1s; 
            -o-transition: opacity 1s; 
            transition: opacity  1s;
            z-index:2;
    
    }
    
    .carousel-fade .next {
    
        left:0;
        opacity:1;
        z-index:1;
    
    }
    
    0 讨论(0)
提交回复
热议问题