javascript - Calculating the highest element in a list and applying this value to all on resize (jQuery) -
i wrote function calculate height value of highest element in list , apply value elements in list. works, not on windows resize. how force function running on resize? here code:
var heightequalizing = function () { var element = $('.tm-whatwedo li'); var elementheights = element.map(function () { return $(this).height(); }).get(); var maxheight = math.max.apply(null, elementheights); element.height(maxheight); console.log(maxheight); }; $(window).resize(heightequalizing); $(document).ready(heightequalizing);
$(window).on('resize', function(){ heightequalizing(); });
update:
maybe misunderstand? in fiddle window resize event fires function: http://jsfiddle.net/jessikwa/r1obmfh2/
Comments
Post a Comment