Bootstrap carousel reveal part of next slide

345
February 09, 2017, at 06:23 AM

I have a bootstrap carousel that is currently scrolling vertically. Is there a way to show a part of the next slide (say 33%) that will sit at the bottom and would sit above the current slide and ideally slide up when sliding. I've set up a fiddle with what I currently have.

Html:

<div class="container">
  <div class="page-header">
    <h1>Bootstrap Vertical Carousel</h1>
    <p class="lead">Out of the box, Bootstrap only comes with a traditional horizontal  carousel. This Pen has the HTML and CSS to get it to animate vertically with up/down carousel controls.</p>
  </div>
</div>
<div class="bg-info">
  <div class="container">
    <div id="carousel-example-vertical" class="carousel vertical slide">
      <div class="carousel-inner" role="listbox">
        <div class="item active">
          <img src="http://placehold.it/350x150/123456">
        </div>
        <div class="item">
          <p class="ticker-headline">
            <img src="http://placehold.it/350x150/236152">
          </p>
        </div>
        <div class="item">
          <img src="http://placehold.it/350x150/096437">
        </div>
        <div class="item">
          <img src="http://placehold.it/350x150/000000">
        </div>
      </div>
      <!-- Controls -->
      <a class="up carousel-control" href="#carousel-example-vertical" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-up" aria-hidden="true"></span>
        <span class="sr-only">Previous</span>
      </a>
      <a class="down carousel-control" href="#carousel-example-vertical" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-down" aria-hidden="true"></span>
        <span class="sr-only">Next</span>
      </a>
    </div>
  </div>
</div>

Css:

body {
  margin: 50px 0;
}
.ticker-headline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 15px 0;
  margin: 0;
  font-size: 18px;
}
.carousel.vertical .carousel-inner {
  height: 100%;
  width: auto;
}
.carousel.vertical .carousel-inner > .item {
  width: auto;
  padding-right: 50px;
  -webkit-transition: 0.6s ease-in-out top;
  transition: 0.6s ease-in-out top;
}
@media all and (transform-3d), (-webkit-transform-3d) {
  .carousel.vertical .carousel-inner > .item {
    -webkit-transition: 0.6s ease-in-out;
    transition: 0.6s ease-in-out;
  }
  .carousel.vertical .carousel-inner > .item.next, .carousel.vertical .carousel-inner > .item.active.right {
    -webkit-transform: translate3d(0, 100%, 0);
            transform: translate3d(0, 100%, 0);
    top: 0;
  }
  .carousel.vertical .carousel-inner > .item.prev, .carousel.vertical .carousel-inner > .item.active.left {
    -webkit-transform: translate3d(0, -100%, 0);
            transform: translate3d(0, -100%, 0);
    top: 0;
  }
  .carousel.vertical .carousel-inner > .item.next.left, .carousel.vertical .carousel-inner > .item.prev.right, .carousel.vertical .carousel-inner > .item.active {
    -webkit-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
    top: 0;
  }
}
.carousel.vertical .carousel-inner > .active,
.carousel.vertical .carousel-inner > .next,
.carousel.vertical .carousel-inner > .prev {
  display: block;
}
.carousel.vertical .carousel-inner > .active {
  top: 0;
}
.carousel.vertical .carousel-inner > .next,
.carousel.vertical .carousel-inner > .prev {
  position: absolute;
  top: 0;
  width: 100%;
}
.carousel.vertical .carousel-inner > .next {
  top: 100%;
}
.carousel.vertical .carousel-inner > .prev {
  top: -100%;
}
.carousel.vertical .carousel-inner > .next.left,
.carousel.vertical .carousel-inner > .prev.right {
  top: 0;
}
.carousel.vertical .carousel-inner > .active.left {
  top: -100%;
}
.carousel.vertical .carousel-inner > .active.right {
  top: 100%;
}
.carousel.vertical .carousel-control {
  left: auto;
  width: 50px;
}
.carousel.vertical .carousel-control.up {
  top: 0;
  right: 0;
  bottom: 50%;
}
.carousel.vertical .carousel-control.down {
  top: 50%;
  right: 0;
  bottom: 0;
}
.carousel.vertical .carousel-control .icon-prev,
.carousel.vertical .carousel-control .icon-next,
.carousel.vertical .carousel-control .glyphicon-chevron-up,
.carousel.vertical .carousel-control .glyphicon-chevron-down {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: inline-block;
}
.carousel.vertical .carousel-control .icon-prev,
.carousel.vertical .carousel-control .glyphicon-chevron-up {
  left: 50%;
  margin-left: -10px;
  top: 50%;
  margin-top: -10px;
}
.carousel.vertical .carousel-control .icon-next,
.carousel.vertical .carousel-control .glyphicon-chevron-down {
  left: 50%;
  margin-left: -10px;
  top: 50%;
  margin-top: -10px;
}
.carousel.vertical .carousel-control .icon-up,
.carousel.vertical .carousel-control .icon-down {
  width: 20px;
  height: 20px;
  line-height: 1;
  font-family: serif;
}
.carousel.vertical .carousel-control .icon-prev:before {
  content: '\2039';
}
.carousel.vertical .carousel-control .icon-next:before {
  content: '\203a';
}
Answer 1

It's not possible without a serious rewrite. Fundamentally, this plugin works by hiding all of the slides:

.carousel-inner>.item {
    position: relative;
    display: none; <- culprit
    -webkit-transition: .6s ease-in-out left;
    -o-transition: .6s ease-in-out left;
    transition: .6s ease-in-out left;
}

However, even if we disable that rule, the animation is still broken. The code displays and repositions one slide at a time.

My recommendation is to look for another plugin that more closely matches your needs.

READ ALSO
Child theme css not overriding parent

Child theme css not overriding parent

I've created a child theme of the twentyseventeen themeIn the child's theme folder I have a "style

261
How to make a div asked like position: fixed without position:fixed?

How to make a div asked like position: fixed without position:fixed?

I need a div to say in the same place while the user scrollsposition: fixed; does just this - however, its messing with my responsive stuff

221
Bootstrap 4: Always display the mobile menu button no matter screen size

Bootstrap 4: Always display the mobile menu button no matter screen size

How can I get always display the mobile menu button no matter screen size? I do not want the links to appear until a person clicks the mobile buttonThank you!

320
How to place content DIV on bootstrap (split screen / both side) and make it responsive? [on hold]

How to place content DIV on bootstrap (split screen / both side) and make it responsive? [on hold]

I want to place 2 content DIV on a split screen both side with bootstrap in large and desktop screensSee the images for your understanding

291