Styleswitcher and re-assessing the height of a dom element afterwards.... Resolved

Styleswitcher and re-assessing the height of a dom element afterwards.... Resolved

Hi,

I've got some style switching code for large text / high contrast.

After applying this new style sheet, I want to recalculate the height of an object based on it's content. I don't want to fix this content's height as it is managed by cms and changes regularly.

The problem is that after the text is enlarged and the element (.column-content) increases in height, I am still returned the old height i.e. although the new css is applied on the screen, my jQuery is not returning the new height. I suppose my question, at what stage can I run my function and have it return the new increased height from the styleswitcher.

Here's my style switcher including my footerHeights function which should reassess the height of the element:
  1. /*
  2. ====================================
  3.   Style switcher
  4. ====================================
  5. */
  6.  $('.styleswitch').click(function()
  7.     {
  8.     relattrib = this.getAttribute("rel");
  9.     switchStylestyle(this.getAttribute("rel"));
  10.     footerHeights()
  11.     return false;
  12.     });
  13.    
  14.     var style = readCookie('style');
  15.     if(style) {
  16.     switchStylestyle(style);
  17.     footerHeights()
  18.     }
  19.     function switchStylestyle(styleName)
  20.     {
  21.         $('link[@rel=*style][title]').each(function(i)
  22.         {
  23.             this.disabled = true;
  24.             if(this.getAttribute('title') == styleName)
  25.                 this.disabled = false;
  26.         });
  27.         largeStyle = styleName;
  28.        
  29.         createCookie('style',styleName,365);
  30.     }
  31.     function createCookie(name,value,days)
  32.     {
  33.         if(days)
  34.         {
  35.             var date = new Date();
  36.             date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
  37.             var expires = "; expires=" + date.toGMTString();
  38.         }
  39.         else
  40.             var expires = "";
  41.         document.cookie = name + "=" + value + expires + "; path=/";
  42.     }
  43.     function readCookie(name)
  44.     {
  45.         var nameEQ = name + "=";
  46.         var ca = document.cookie.split(';');
  47.         for(var index = 0; index < ca.length; index++)
  48.         {
  49.             var c = ca[index];
  50.             while(c.charAt(0 )== ' ')
  51.                 c = c.substring(1,c.length);
  52.             if(c.indexOf(nameEQ) == 0)
  53.                 return c.substring(nameEQ.length,c.length);
  54.         }
  55.         return null;
  56.     }
  57.     function eraseCookie(name)
  58.     {
  59.         createCookie(name,"",-1);
  60.     }
  61. /*
  62. ====================================
  63.   Resize column content
  64. ====================================
  65. */
  66.     function footerHeights()
        {
                var max_height = 0;
                $("#footer .column-content").each
                (
                    function (i)
                    {
                        alert($(this).height());
                        if ($(this).height() > max_height)
                            max_height = $(this).height();
                           
                    }
                );
                $("#footer .column-content").height(max_height);
        }













Thanks in advance!

Nick