首页 > 微信网站,input标签旋转90度后键盘如何横屏弹出

微信网站,input标签旋转90度后键盘如何横屏弹出

因为做一个横屏的微信游戏,有一个输入玩家信息的地方,要横屏展示。
将input旋转90度后键盘还是竖屏弹出,怎么能横屏弹出


已有类似问题,请参考:

https://.com/q/1010000002793002?_ea=209862

希望有所帮助~ :)


w3c标准,不知道好用不好用;The Screen Orientation API

4.1 Locking the screen orientation

The steps for locking the screen orientation are as follows:

If the user agent does not allow the current browsing context to lock the screen orientation, the steps must stop here and return false. For example, a user agent might only allow browsing context in a fullscreen state to lock the screen orientation or browsing context with elevated privileges.
Let orientations be the list of locking orientations.
For each orientation in the orientations list, run the following sub steps:
If orientation isn't part of the allowed orientations, the steps must stop here and return false.
If orientation is portrait or landscape the value must be removed from orientations and every allowed orientations it is representing must be inserted in orientations.
If orientations isn't a supported orientations set, the steps must stop here and return false.
Return true and run the remaining steps asynchronously.
The user agent must lock the orientation to orientations.


// 强制竖屏
window.screen.lockOrientation([“portrait-primary”,“portrait-secondary”]);
// 强制横屏
window.screen.lockOrientation([“landscape-primary”,“landscape-secondary”]);
// 取消强制
window.screen.unlockOrientation();

PS:由于腾讯出品,不保证w3c好用;


键盘的弹出方式只取决于设备当前所处的状态(是横屏还是竖屏)。你虽然在网页内部对输入框进行旋转,但是相对于系统来说,微信还是处于竖屏状态的。
我觉得让用户在竖屏下输入信息也是可以接受的,如果非要横屏下输,那只能自己弄一个虚拟键盘了(不过虚拟键盘又不方便处理中文输入的问题)。

【热门文章】
【热门文章】