Javascript 如何针对不同手机的横向模式

Javascript 如何针对不同手机的横向模式,javascript,iphone,mobile,media-queries,samsung-mobile,Javascript,Iphone,Mobile,Media Queries,Samsung Mobile,我正在尝试删除一个javascript事件,该事件仅适用于处于横向模式的手机。我尝试过使用CSS媒体查询,但没有成功,但我找不到正确的答案 例如,如何涵盖至少检测iphone4和三星Galaxy 3横向模式的代码?两者都是移动设备,但尺寸不同 是否有只针对横向移动设备的媒体查询解决方案 /* Smartphones (portrait and landscape) ----------- */ @media only screen and (min-device-width : 320px)

我正在尝试删除一个javascript事件,该事件仅适用于处于横向模式的手机。我尝试过使用CSS媒体查询,但没有成功,但我找不到正确的答案

例如,如何涵盖至少检测iphone4和三星Galaxy 3横向模式的代码?两者都是移动设备,但尺寸不同

是否有只针对横向移动设备的媒体查询解决方案

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}
是否有javascript解决方案只针对横向移动设备

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}