Skip to content

Instantly share code, notes, and snippets.

@ChaseIndustries
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChaseIndustries/077b509db436abe9f9d2 to your computer and use it in GitHub Desktop.
Save ChaseIndustries/077b509db436abe9f9d2 to your computer and use it in GitHub Desktop.
Bootstrap - Set all bootstrap slides to the same height on load (add this to your window onload)
//set the slides to all the same height
if($(".carousel").length){
var maxHeight,items,numSlides;
$(".carousel").each(function(){
maxHeight = 0,
items = $(this).find(".item"),
numSlides = items.length;
items.each(function(i){
var h = $(this).height();
if(h > maxHeight){
maxHeight = h;
}
if(i == numSlides-1){
items.height(maxHeight);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment