如何将手机设置为仅纵向,并允许平板电脑在纵向和横向之间切换?
我正在使用 Ionic/Cordova。
目前,我已使用以下属性在 config.xml 中将应用程序设置为纵向模式
<preference name="orientation" value="portrait" />
你可以使用isTablet插件 https://github.com/dpa99c/phonegap-istablet和这个结合屏幕方向插件 https://github.com/gbenvenuti/cordova-plugin-screen-orientation, 就像是:
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.isTablet){
screen.unlockOrientation();
}else{
screen.lockOrientation('portrait');
}
});
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)