开发者

How to pass the onorientationchange() event to iframe sites?

How can I pass the onorientationchange() event to iframe-开发者_JAVA百科based sites?


Try this:

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;
        }
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜