samedi 16 juillet 2016

On resize recalculate height and "destroy script" at viewport < 680

I use a script on my site, it calculates the highest height of an other div with the same .sh class. Both get the same height. This works but on viewport < 680 it doesn't need to work. Also on resize the viewport the height isn't updated/recalculated.

Can anyone help me out with this?

I made a fiddle with an example. https://jsfiddle.net/ctb9f3c1/

jQuery(document).ready(resizeTheHeights);
function resizeTheHeights() {
    var allHeights = [];
    $('.sh').each(function() {
        var thisHeight = $(this).height();
        allHeights.push(thisHeight);
    });
    var highestHeight = Math.max.apply(Math, allHeights);
    $('.sh').height(highestHeight);
}

Aucun commentaire:

Enregistrer un commentaire