jquery function recalculate height on click -


i have simple function calculates height of div. have font size increaser on site, , want recalculate height if clicked:

http://jsfiddle.net/tsh2l/

var boxheight = function($item) {         var $this;         var heightarray = [];         $item.each(function() {             $this = $(this);             heightarray.push($(this).height());         });         var biggest = math.max.apply( math, heightarray );         $item.parent('div').children($this).css('height', biggest);     }     $(function() {         boxheight($('.box'));         $('#fontsize li').on('click', function() {             boxheight($('.box'));         });     }); 

i need recalculate height once user has clicked on #fontsize li, , wanted make simple possible. im not sure if re call function doesnt work. may how added array

any appreciated

hey maybe try this

js fiddle example

i didn't debug code if had guess going wrong i'd targeting wrong element when try , set height line here,

$item.parent('div').children($this).css('height', biggest);

that bit of code won't work me thinks. try changing to

$item.css('height', biggest);


Comments