// scroll to heading of open collapse item so content is presented on the screen $(function() { $('.panel-collapse').on('shown.bs.collapse', function (e) { var $panel = $(this).closest('.panel'); $('html,body').animate({ scrollTop: $panel.offset().top }, 250); }); }); // make things in a group the same height function sameHeightenator(groupToSameHeight, sameHeighters) { $(groupToSameHeight).each(function() { var tallest = 0; $(sameHeighters).each(function() { tallest = tallest > $(this).height() ? tallest: $(this).height(); }); $(sameHeighters).each(function() { $(this).height(tallest); }); }); } $(function() { // example sameHeightenator('.card-group.row', '.card'); sameHeightenator('.carousel.row', '.carousel-item'); });