gpt4 book ai didi

javascript - Mottie 虚拟键盘,隐藏原生 Android Input Keyboard

转载 作者:行者123 更新时间:2023-11-28 13:01:06 27 4
gpt4 key购买 nike

我正在尝试使用 jquery 虚拟键盘 - http://mottie.github.io/Keyboard/mobile.html为移动网络应用程序创建一个只有数字的输入文本和几个加速键。

但是,我遇到了一个大问题,即当我按下输入框以触发屏幕/虚拟键盘时,会触发 native android 键盘。如何只触发虚拟键盘,其他插件也可以。我测试了几个都有同样的问题。

也许有一种方法可以禁用输入字段,这样它就不会触发 native 键盘但仍会触发屏幕键盘?将输入设置为“只读”有一些问题。

我和其他用户有同样的问题:https://stackoverflow.com/questions/15289281/disable-mobile-default-keyboard-to-show-up-using-my-own-virtual-keyboard-web-a然而他的问题没有答案。

第一次尝试

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

<title>Virtual Keyboard Basic Demo</title>

<!-- demo -->
<link href="demo/demo.css" rel="stylesheet">

<!-- jQuery & jQuery UI + theme (required) -->
<link href="http://code.jquery.com/ui/1.9.0/themes/ui-darkness/jquery-ui.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js"></script>
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.min.js"></script>

<!-- keyboard widget css & script (required) -->
<link href="css/keyboard.css" rel="stylesheet">
<script src="js/jquery.keyboard.js"></script>

<!-- keyboard extensions (optional) -->
<script src="js/jquery.mousewheel.js"></script>
<!--
<script src="js/jquery.keyboard.extension-typing.js"></script>
<script src="js/jquery.keyboard.extension-autocomplete.js"></script>
-->

<!-- initialize keyboard (required) -->
<script>
$(function(){
alert("Keyboard ON");
//$('#keyboard').keyboard();
$('#keyboard').on('click tap vclick', function (event) {
//alert("detected touch");
event.stopImmediatePropagation();
event.preventDefault();

$('#keyboard').keyboard();
});
});
</script>

</head>

<body>

<!-- Links to other demo pages & docs -->
<div id="nav">
<a href="index.html">Main Demo</a>
<a class="current" href="basic.html">Basic</a>
<a href="mobile.html">Mobile</a>
<a href="layouts.html">Layouts</a>
<a href="navigate.html">Navigate</a>
<a href="calculator.html">Calculator</a>
<a class="play" href="http://jsfiddle.net/Mottie/MK947/">Playground</a>
<a class="git" href="https://github.com/Mottie/Keyboard/wiki">Documentation</a>
<a class="git" href="http://github.com/Mottie/Keyboard/downloads">Download</a>
<a class="issue" href="https://github.com/Mottie/Keyboard/issues">Issues</a><br><br>
</div>
<!-- End Links -->

<div id="wrap"> <!-- wrapper only needed to center the input -->

<!-- keyboard input -->
<input id="keyboard" type="text">
<div><p>Static TEST</p></div>

</div> <!-- End wrapper -->

</body>

最佳答案

我添加了以下代码,它看起来确实有效,但是需要更多测试才能使其成为可靠的解决方法:

$('.keyboard').on('focus click tap vclick', function (event) {
event.stopImmediatePropagation();
event.preventDefault();

$('.keyboard').blur();
});

关于javascript - Mottie 虚拟键盘,隐藏原生 Android Input Keyboard,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16144509/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com