Thursday, December 13, 2012

Finding real body height using jQuery

function getDocumentHeight() {
    if ($.browser.msie) {
        var $temp = $("<div>")
            .css("position", "absolute")
            .css("left", "-10000px")
            .append($("body").html());

        $("body").append($temp);
        var h = $temp.height();
        $temp.remove();
        return h;
    }
    return $("body").height();
}

No comments:

Post a Comment