如何将onorientationchange()
事件传递给基于iframe的网站?
答案 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;
}
}
}