Saturday, 15 May 2010

javascript - resize divs to auto and then to same height as one another upon window resize? -


I want to resize the size of the three column divs so that they all do the same length, (I have been able to do that though, unfortunately I am unable to give it attribution, if I can get it, then it will be updated):

  function resizeIt ( ) {Var is the largest = 0; $ (".featured"). Each (function () {// loop is through a section var isHigh = $ (this). Find Height (); // Height (if HEIT> largest) {// See whether this height is "Largest "Height is greater than = highest = searchhigh; // if it is high, then set it to the highest height}}); $ (".feed") CSS ({"height": largest + "pixels"}). }  

It works fine, but I also want the device to resize the size of the window every time. So I modified the function and then every time the window resizes and calls the function, as well as on the page load. Here is a modified function (the first line of the function is additionally) Function call for the size of the plus window size:

  Change the size of the function () {$ (". CSS ({"height: auto"}); Largest = 0; $ (".featured"). Each (function () {// loop is through a section var isHigh = $ (this). Find Height (); // Height (if HEIT> largest) {// See whether this height is "Largest "Height is greater than = highest = searchhigh; // if it is high, then set it to the highest height}}); $ (".feed") CSS ({"height": largest + "pixels"}). } ResizeIt (); $ (Window). Reset (function () {resizeIt ();});  

Now my div is not properly shaped on page load or on page size. Nothing happens. If I keep some kind of warning in my function, then it is not called when

  $ (".feed"). CSS ({"height: auto"});  

The line is included in the function. Why is this line breaking my code? The object is present when I call it on the first row, so this is not a blank object.

Why not try to resize media queries? This will allow the device to resize on window resizing without having to reload the page

  @ media (max-width: 1200 px) {.feature {/ new height value * / / * New width value * /}} @ Media (max-width: 767 px) {.feature {/ New height value * / / * New width value * /}}  

No comments:

Post a Comment