画面の高さに関係なく、各サイトのコンテンツを真ん中にしたいサイトがあります。
私が達成しようとしているのは、次のようなものです。
#content {position:absolute; top:50%; height:240px; margin-top:-120px; /* negative half of the height */}
そして、これをコーディングする方法がわかりません:
function fullscreenHeight(){
var window_height = $(window).height();
var negative_margin = window_height / 2 * -1;
$('.pageclass01').css({height:window_height});
$('.pageclass01').css({margin-top:negative_margin});
}
fullscreenHeight();
$(window).bind('resize',function() {
fullscreenHeight();
});
これで私を助けることができる人はいますか?:)