Saturday 15 March 2014

jquery - Automatically resize columns height on hide/show divs (part 2) -


I would like to automatically change the height of my 2 columns (when I hide some functions by the toggle function) / Show).

  & lt; Div class = "span2 sameht" & gt; & Lt; Div class = "content" & gt; & Lt; Div class = "hidelevel" & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "span3 sameht" & gt; & Lt; Div class = "content" & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;! - How to do it after the hidden divs - & gt; & Lt; Div class = "span2 sameht2" & gt; & Lt; Div class = "content" & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "span3 sameht2" & gt; & Lt; Div class = "content" & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; Div & gt; Some & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt ;! - Toggle - & gt; & Lt; Div id = "toggle" & gt; Tug visibility is the same & lt; / Div & gt;   

The same height for the columns using this code

  $ (function () (adjusted;); $ ("# toggle") .click (function () {$ (".lelelevel"). Toggle (); Adjusted RIGHT ();});}); Function Adjustment () {var maxHeight = 0 $ ('. Sameht'). Each (function () {if ($ (this). High ()> maxHyight) {maxHeight = $ (this) .height ();}}); $ ('. Sameht') height (maxHeight). } Var maxHeight = 0 $ ('. Sameht2'). Each (function () {if ($ (this) .ight ()> maxHeight} {maxHeight = $ (this) .height ();}}); $ ('. Sameht2') height (maxHeight).   

When I hide divs (.hidelevel) and adjust the call call, the "same" column does not change the height of column height (see how it should be).

Do you have any idea how can I do this? Thank you.

You can use

  $ ('.jhht2') CSS ('height', '500px').  

JD

No comments:

Post a Comment