jQuery - IF height is greater than 2 separate divs -
ok, asked question earlier didn't desired effect. result i've decided tackle in way...
i'm trying container increase in height if either (or both) of 2 panels expanded.
var content = $("#content_container");   var childaheight = $('#news_events_panel').height(); var childbheight = $('#headteachers_panel').height();      if (content < childaheight, childbheight) {         $(content).css("height", 657 + "px");     } this working fine , increases height of container 657px when panels open.
the tricky bit next bit...
the user can open both panels individually , problem i'm having container returns auto height when user closes 1 of them. need container return auto if both panels closed.
if (content > childaheight & childbheight) {         $(content).css("height", "auto"); } basically, need 2nd script read "if content greater childaheight , childbheight, return "auto". if not, keep height.
there's easy solution, i'm very new , not clued on jquery functions.
just add them suppose :
if ( content.height() > (childaheight + childbheight) ) {         content.css("height", "auto"); } 
Comments
Post a Comment