Skip to content

Instantly share code, notes, and snippets.

@monkishtypist
Last active October 27, 2018 16:07
Show Gist options
  • Save monkishtypist/67c72632979d3357339ec08316c0390e to your computer and use it in GitHub Desktop.
Save monkishtypist/67c72632979d3357339ec08316c0390e to your computer and use it in GitHub Desktop.
Set Bootstrap carousel item heights
@monkishtypist
Copy link
Author

I frequently use Bootstrap Carousels in builds as a content slider, for example for testimonials. By default however the carousel height is not fixed and resizes based on the content. Since content length can differ from slide to slide, this causes page jumping and the last line of text can appear to be clipped momentarily while sliding in.

To fix this, I use this jQuery to calculate the height of the largest slide and apply that height to all other slides essentially creating a fixed height carousel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment