Wednesday, October 3, 2012

javascript/jquery: Adjusting div height as window height changes


$(function () {

    function winresize() {
        var windowHeight = $(window).height();
        if (windowHeight > 300) {
            windowHeight = windowHeight - 200;
        }

        $("#bboard").css("margin-top", windowHeight);
    }

    winresize();

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

No comments: