【问题标题】:AutocompleteUI + jQuery On-Screen KeyboardAutocompleteUI + jQuery 屏幕键盘
【发布时间】:2016-01-26 19:40:15
【问题描述】:

我有搜索字段和虚拟键盘。从我的桌面键盘输入一些字母后,一切正常,并在单独的 div 中打印结果。

当我想得到结果时,从虚拟键盘上写一些字母或单词,没有任何反应。我知道我需要在这个虚拟键盘上使用回调。但是我觉得很难做到!提前致谢!

自动完成代码:

var some_array = [  {...},
                        {...},
                        ...];
$(function() {
    $("#tags").autocomplete({
        source: some_array,
        autoFocus: true,
        minLength: 0,
        delay: 400,
        suggest: function(items) {
            $('.results').hide(); 
            $(".results").empty();
            for (i = 0; i < items.length; i++){
                var person = $('<div id="pers" style="pers"><img src="./img/photo/'+ items[i].value +'.jpg" class="photo_preview">'+ items[i].label +'<br /><br /><small>'+ items[i].desc +'</small></div>');
                $(".results").append(person);
            }
            $(".results").show(200);
        }
    });    
});

库键盘的一小部分,按下后触发:

write: function(m) {
           var a = jsKeyboard.currentElement.val(),
           b = String.fromCharCode(m),
           pos = jsKeyboard.currentElementCursorPosition,
           output = [a.slice(0, pos), b, a.slice(pos)].join('');
           jsKeyboard.currentElement.val(output);
           jsKeyboard.currentElementCursorPosition++; //+1 cursor
           jsKeyboard.updateCursor();
       }

【问题讨论】:

    标签: jquery callback keyboard virtual


    【解决方案1】:

    我找不到合适的听众,以不同的方式解决了问题。安装了chrome虚拟键盘的扩展,没有问题。 P.S. 为触摸屏面板开发软件,而不是为公众开发的,因此对于 1 个工作站来说是理想的。谢谢大家。

    【讨论】:

      猜你喜欢
      • 2015-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多