ishikawa

frontend engineer in yamagata

アクセス時、全画面に画像を表示させる

Posted in: NotesjQuery

とりいそぎ、覚書き。

// CSS
#section01 {
  background: url("sample.jpg") no-repeat 50% 50%;
  background-size: cover;
}
// script
$(document).ready(function(){
    hsize = $(window).height();
    $("#section01").css("height", hsize + "px");
});
$(window).resize(function(){
    hsize = $(window).height();
    $("#section01").css("height", hsize + "px");
});