BathHacked/energy-sparks

View on GitHub
app/assets/javascripts/carousels.js

Summary

Maintainability
A
0 mins
Test Coverage
"use strict"

function normalizeDashboardEquivalences() {
  $('.dashboard-equivalences-component').each(function(){
    var items = $('.carousel-item', this);
    // reset the height
    items.css('min-height', 0);
    // set the height
    var maxHeight = Math.max.apply(null,
        items.map(function(){
            return $(this).outerHeight()}).get() );
    items.css('min-height', maxHeight + 'px');
  });
}

$(window).on(
    'load resize orientationchange',
    normalizeDashboardEquivalences);