Tabs: calculate and set a fixed height
Hi all, I have a question on Tabs plugin.
With the default css'n'xhtml reference tab-plugin site, I want to
calculate the highest <div> and set its height to each <div>, so the
html comes after do not move while switching tabs.
So, I wrote this code:
$(document).ready(function() {
/***Put in a new array all the heights***/
var arr = new Array();
$.each( $('#div-container > div'), function(i,j) { arr[i] = $
(j).height();});
/***Take the highest and set that height to the container***/
$('#div-container').height(arr.sort().pop()+30); /***+30 for
paddings***/
/***After that, tabs calling***/
$('#container > ul').tabs({fx: { opacity: 'toggle' , duration:
800 }}).tabs('rotate', 4500);
});
This works really fine if i put a stop command, such an alert() before
the tabs calling, but is pretty buggy without it cause tabs are called
before (I suppose) $.each and $('#div.....') can finish their
commands.
My divs are from 200 to 250px, and the code above many times returns
me from 10 to 90 :\
But, I repeat, if I put and alert() before the tab calling, everything
works fine.
I tried to put in and out, before and after the document.ready each
part of code, but nothing happened.
Can someone help me?