Bootstrap Carousel showing next and previous image

前端 未结 3 540
甜味超标
甜味超标 2020-12-01 13:39

Is the bootstrap carousel extendible to show the next and previous images in the slider?

    
3条回答
  •  被撕碎了的回忆
    2020-12-01 14:03

    It is possible with Bootstrap, but requires some customizations...

    See this example on Bootply: http://bootply.com/94444

    You have to customize the position of the slides using CSS and jQuery..

    .carousel-inner .active.left { left: -33%; }
    .carousel-inner .next        { left:  33%; }
    .carousel-inner .prev        { left: -33%; }
    

    Another variation is only reveal a portion of the next and previous slides. This can be done by placing an absolute position overlay over the left and right side of the carousel-inner..

    .carousel-inner:before {
        position:absolute;
        top:0;
        bottom: 0;
        right: 82%;
        left: 0;
        content:"";
        display:block;
        background-color: #fff;
        z-index: 2;
    }
    .carousel-inner:after {
        position:absolute;
        top:0;
        bottom:0;
        right: 0;
        left: 82%;
        content:"";
        display:block;
        background-color:#fff;
        z-index: 2;
    }
    

    Demo of partial next/prev: http://www.codeply.com/go/QGkUVSqil8

提交回复
热议问题