Hey everyone!
I have several divs which all have the class content. Only one div is made visible at a time using this code -
What I'd like to do is get the height of the div that is currently visible and assign it to a variable like this, but it doesn't work...Code:function hidedivs() { //HIDE UN-NEEDED DIVS var contentid=new Array(); contentid[0]="con1"; contentid[1]="con2"; contentid[2]="con3"; for(i=0;i<contentid.length;i++) { document.getElementById(contentid[i]).style.display = 'none'; } } function swapcontent(contentid) { hidedivs(); //document.getElementById(contentid).style.display = 'block'; $('#' + contentid).fadeOut().delay(50).fadeIn(800); $('#sideBar').fadeOut().delay(50).fadeIn(800); }
Any help?Code:$(".content").each(function (w) { if(w.style.display != "none") { var heightvar = w.height(); } else { } });



Reply With Quote

Bookmarks