Q:

Jquery calculate height difference between .ready and .resize

There seems to be a difference in height calculation when initializing a page or resizing a page.
Anyone that has any clue why? Or how to fix it?
Example Code
$(document).ready(function () {

    showcase_height_init();

    $(window).resize(function() {
        showcase_height_init();
    });

});

function showcase_height_init() {

    var showcase_container_text_height = ($("#showcase_container_text").height())/2;

    $("#showcase_container_text").css({
        margin: '-'+showcase_container_text_height+'px 0 0'
    });

}

A:

The "ready" event is triggered as soon as the DOM is available therefore is possible that attributes as style, images and other resources aren't loaded and the height of an element don't be the real.
For this purpose you should try:
$("body").load(function () {

    showcase_height_init();

    $(window).resize(function() {
        showcase_height_init();
    });

});

function showcase_height_init() {

    var showcase_container_text_height = ($("#showcase_container_text").height())/2;

    $("#showcase_container_text").css({
        margin: '-'+showcase_container_text_height+'px 0 0'
    });

}

I recommend jquery's documentation:
http://api.jquery.com/ready/

