戻る

画面の幅の有無を取得する

JavaScript

if(document.width <= 767){
	//幅が767px以下のデバイス
}
else if(document.width <= 1024){
	//幅が1024px以下のデバイス
}
else{
	//幅が1024pxよりも大きいデバイス
}

CSS

@madie (max-width: 767px){
	幅が767px以下のデバイス
}

@media (min-width: 768px) and (max-device-width: 1024px){
	幅が768px以上、1024px以下のデバイス
}

inserted by FC2 system