Firefox mobile (android) 和orientationchange

标签 firefox mobile android-orientation orientation-changes

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

毕竟,我如何检测方向变化?

最佳答案

Firefox for Android 不支持orientationchange 事件,但您可以通过使用媒体查询监听器来实现相同的结果。

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

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

关于Firefox mobile (android) 和orientationchange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13111075/

相关文章:

image - 为什么 Firefox 似乎没有缓存图像?

php - 是否有模仿 User-Agent 字符串的 iPhone 模拟器,以便我可以使用 php-mobile-detect?

css - iPhone 上的媒体查询

android - 当手机方向发生变化时,EditText 如何保留其值而不是 textview?

android - 为什么 onLayout 和 onSizeChanged 在方向改变时被调用两次?

android - 如何在android中更改相机方向

Firefox gBrowser.selectedBrowser ID

javascript - 字段焦点在 Firefox 中不起作用,setTimeout(function(){id.focus();},0);

python - DeprecationWarning : firefox_binary has been deprecated, 请使用 Selenium Python 中的参数 firefox_binary 传入 Service 对象

security - 使用 bcrypt 为移动应用散列 5 位密码