如何将onorientationchange()事件传递给iframe网站?

时间:2011-03-09 06:16:43

标签: iphone uiwebview

如何将onorientationchange()事件传递给基于iframe的网站?

1 个答案:

答案 0 :(得分:-1)

试试这个:

window.addEventListener('load', function(){
    if (self != top) {
      window.top.location = window.self.location;
    }
    window.onorientationchange = function () {
        switch (window.orientation) {
            case 0:
                alert('PORTRAIT');
                break;
            case 90:
                alert('LANDSCAPE');
                break;
            case -90:
                alert('LANDSCAPE');
                break;
        }
    }
}