Can the Twitter Bootstrap Carousel plugin fade in and out on slide transition

前端 未结 6 1168
时光取名叫无心
时光取名叫无心 2020-11-30 19:36

I have a very basic implementation of the Twitter Bootstrap Carousel plugin on a site that I am working on (http://furnitureroadshow.com/). I was just wondering if anyone h

6条回答
  •  隐瞒了意图╮
    2020-11-30 20:07

    Yes. Bootstrap uses CSS transitions so it can be done easily without any Javascript.

    The CSS:

    .carousel .item {-webkit-transition: opacity 3s; -moz-transition: opacity 3s; -ms-transition: opacity 3s; -o-transition: opacity 3s; transition: opacity 3s;}
    .carousel .active.left {left:0;opacity:0;z-index:2;}
    .carousel .next {left:0;opacity:1;z-index:1;}
    

    I noticed however that the transition end event was firing prematurely with the default interval of 5s and a fade transition of 3s. Bumping the carousel interval to 8s provides a nice effect.

    Very smooth.

提交回复
热议问题