How do I get an elements height after $.get ... ?

How do I get an elements height after $.get ... ?

Hi there,

I'm doing my first script with jquery and can't figure out how I can get an element's height after I loaded content to it using $.get(). The alert you see in the code below shows 0, even when I loaded HTML content to the respective element before. Any ideas? Thank you very much!

  1. function showDetailbox(e,clicked,scrollto) {
  2.     var opened;
  3.     if($(clicked).parent().hasClass('current')) opened = true;
  4.     if(e) e.preventDefault();
  5.     if(scrollto) $('html, body').animate({ scrollTop: $(clicked).offset().top - 100}, 300);
  6.     if(!opened) {
  7.         ;
  8.         for(var i = 0;i<$('.tile-content').length;i++) {
  9.             $('.tile-spacer').eq(i).slideUp();
  10.             $('.detail-box').eq(i).slideUp();
  11.             $('article.list').removeClass('current');
  12.         }
  13.         
  14.         
  15.         var topPx = $(clicked).offset().top;
  16.         var checkHeight = -1;
  17.         var currentTop = 0;
  18.         var href = $(clicked).find('a').attr("href");
  19.         var ajaxHref = href.substring(href.indexOf('#')).replace(/#/,'');
  20.         if(!ajaxHref) ajaxHref = href; 
  21.         window.location.hash = ajaxHref;
  22.         $.get(ajaxHref, function(data) {
  23.             $(clicked).parent().find('.detail-box-inner').html(data);
  24.         });
  25.         $(clicked).parent().find('.detail-box').slideDown(400,'swing',function() {
  26.             if(scrollto) $('html, body').animate({ scrollTop: $(clicked).offset().top - 100}, 300);
  27.             else $('html, body').animate({ scrollTop: $(clicked).offset().top - 100}, 0);
  28.                         
  29.         });
  30.         for(var i = 0;i<$('article.list').length;i++) {
  31.             currentTop = $('article.list').eq(i).offset().top;
  32.             if(checkHeight < 0 && currentTop > topPx) checkHeight = $('article.list').eq(i).offset().top;
  33.             if($('article.list').eq(i).offset().top == checkHeight) $('.tile-spacer').eq(i).slideDown();
  34.         }
  35.        
  36.         // *** Alert to check if it works
  37.         alert($(clicked).parent().find('.detail-box-inner').height());
  38.         
  39.         $(clicked).parent().addClass('current');
  40.         
  41.     }
  42.     else {
  43.         for(var i = 0;i<$('.tile-content').length;i++)     $('.tile-spacer').eq(i).slideUp();
  44.         $(clicked).parent().find('.detail-box').slideUp(400,'swing',function() {
  45.             $(clicked).parent().removeClass('current')});

  46.         window.location.hash = '';

  47.     }

  48. }
Regards
joschi81