欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript判斷iphone/android手機(jī)橫豎屏模式的函數(shù)

 更新時(shí)間:2011年12月20日 00:51:35   作者:  
iphone能很好的使用onorientationchange事件,但是android的onresize事件即使不旋轉(zhuǎn)也會(huì)觸發(fā)多次
查了不少資料,最后結(jié)論如下:
復(fù)制代碼 代碼如下:

function orientationChange(){
switch(window.orientation) {
case 0: // Portrait
case 180: // Upside-down Portrait
// Javascript to setup Portrait view
break;
case -90: // Landscape: turned 90 degrees counter-clockwise
case 90: // Landscape: turned 90 degrees clockwise
// Javascript to steup Landscape view
break;
}
}
window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", orientationChange, false);

相關(guān)文章

最新評(píng)論