I have a function that centers a website vertically:
    function centerWebsite(){
        $vpheight = $(window).height();
        $headerheight = $('header').height();
        $contentheight = $headerheight + $('#content').height();
        $margin = Math.floor(($vpheight - $contentheight)/2);
        $logospacing = $('#logo').css('margin-top');
        if($vpheight > ($contentheight + $logospacing)) {
            $margin = $margin - $logospacing;
        }
        $extendedmargin = $headerheight + $margin;
        $('html').height($vpheight);
        $('body').height($vpheight);
        $('header').css('padding-top', $margin);
        $('#content').css('padding-top', $extendedmargin);
        $('#gallerynav').css('padding-top', $extendedmargin);
    }
This function should be called when the page is ready:
$(document).ready(centerWebsite());
And every time the window gets resized I want to call the same function. I tried to do it like this:
$(window).resize(centerWebsite());
But this won’t work. The solution to this was:
$(window).resize(function() {
    centerWebsite();
});
Do I really need to create a function to call another function?
 
     
     
    