こんな感じです。jQuery3以上を使っている場合は、functionで囲う必要はありません。
$(window).on('load resize', function() {
var h = $('#header').height();
$( '#contents' )
.css({
'margin-top' : h + 'px',
})
});
こんな感じです。jQuery3以上を使っている場合は、functionで囲う必要はありません。
$(window).on('load resize', function() {
var h = $('#header').height();
$( '#contents' )
.css({
'margin-top' : h + 'px',
})
});