wowchemy-carousel.js 863 B

12345678910111213141516171819202122232425
  1. /* ---------------------------------------------------------------------------
  2. * Normalize Bootstrap Carousel Slide Heights.
  3. * --------------------------------------------------------------------------- */
  4. function normalizeCarouselSlideHeights() {
  5. let carousels = document.querySelectorAll('.carousel');
  6. carousels.forEach((carousel) => {
  7. let items = carousel.querySelector('.carousel-item');
  8. let maxHeight = Math.max.apply(
  9. null,
  10. items
  11. .map(function () {
  12. return this.outerHeight();
  13. })
  14. .get(),
  15. );
  16. items.forEach((item) => {
  17. item.style.minHeight = maxHeight + 'px';
  18. });
  19. });
  20. }
  21. window.addEventListener('load', normalizeCarouselSlideHeights);
  22. window.addEventListener('resize', normalizeCarouselSlideHeights);
  23. window.addEventListener('orientationchange', normalizeCarouselSlideHeights);