Firefox mobile(android)和方向更改

Firefox mobile(android)和方向更改,firefox,mobile,android-orientation,orientation-changes,Firefox,Mobile,Android Orientation,Orientation Changes,该事件在firefox mobile for android中不起作用 究竟如何检测方向变化?Firefox for Android不支持方向变化事件,但您可以通过使用媒体查询侦听器获得相同的结果 var mqOrientation = window.matchMedia("(orientation: portrait)"); // The Listener will fire whenever this either matches or ceases to match mqOrientat

该事件在firefox mobile for android中不起作用


究竟如何检测方向变化?

Firefox for Android不支持方向变化事件,但您可以通过使用媒体查询侦听器获得相同的结果

var mqOrientation = window.matchMedia("(orientation: portrait)");

// The Listener will fire whenever this either matches or ceases to match
mqOrientation.addListener(function() { self.handleViewportChange(); });

这就像是android ff上的一个魅力

$( window ).resize(function() {
  alert($( window ).height());
});

如何在代码中使用它?window.addEventListener('orientationchange',handleOrientation,false);收到错误消息或未触发?这个设备有运动检测器吗?没有错误。Galaxy s 1。firefox是唯一一个有问题的浏览器。嗨,我不明白这是怎么回事,你有类似于警报或console.log的代码样本来检查方向的变化吗?