5

ユーザーの画面解像度のサイズに応じて div クラス 'content' のサイズを変更したい。

これまでのところ、私はこのjavascriptを書いています

function resize()
{

    if ((screen.width>1024)) { $(".content").style.width = 560 + "px"; $(".content").style.height = 315 + "px" }
    if ((screen.width>1280)) { $(".content").style.width = 640 + "px"; $(".content").style.height = 360 + "px" }
    else { $(".content").style.width = 853 + "px"; $(".content").style.height = 480 + "px" }
};

そして明らかにhtmlにはクラス「.content」があります

このコードが機能しないのはなぜですか?

4

2 に答える 2