2

I have a carousel with items that have variable height in responsive, and I want to center them vertically in the .carousel-inner container. And I do (using flex, top & transform, etc)... but they're centered only when they have finished the animation when becoming active, so they are aligned top at first, then go down and it seems like it jumps.

I think it's something about the Bootstrap animations for the carousel but I haven't figure it out. The page is https://zuckermanlaw.swapps.io, the carousel is in the Our Services section. I'd appreciate any help. Thanks.

Julián Bonilla
  • 385
  • 1
  • 4
  • 18

2 Answers2

1

Just add the height same as your carousel-inner class has to below mention class, though it stretch images a little bit but fix your issue.

section.third-section #carousel-our-services .carousel-inner .item .carousel-caption {
        display: flex;
        height: 365px;    
    }

I hope this helps you. Enjoy :)

Jyoti Pathania
  • 4,944
  • 1
  • 17
  • 29
1

I played around with this and came up with this.

    @media (-webkit-transform-3d), not all
    .carousel-inner>.item.active, .carousel-inner>.item.next.left, .carousel-inner>.item.prev.right {
position: absolute;
left: 0;
right: 0;
top: 50%;
transform: translate(0,-50%); // IE9
transform: translate3d(0,-50%,0); // Modern Browsers 
    }

I replaced all declarations for that selector. It changes the animation style, but it does vertically align. Personally, I think that looks cool but you might not. I thought it was still worth showing to you. It might be a good start for you. I did this in the browser inspector, and that was the only change I made.

Vcasso
  • 1,328
  • 1
  • 8
  • 14