2011-07-26 35 views
1

我試圖檢測屏幕旋轉中的Webkit對我的摩托羅拉Droid 1.我有以下的JavaScript代碼:Android的檢測旋轉和屏幕寬度

var supportsOrientationChange = "onorientationchange" in window, 
    orientationEvent = supportsOrientationChange ? "orientationchange" : "resize"; 

window.addEventListener(orientationEvent, function() { 
    alert("screen.width: " + screen.width + ", window.orientation: " + window.orientation); 
}, false); 

的問題是:它提醒screen.width 569,當手機在縱向旋轉,在橫向旋轉時爲320。這對我來說沒有任何意義!有人可以澄清嗎?

謝謝 伊戈爾

回答