2012-08-10 85 views
3

我正在使用此插件(http://www.jquery4u.com/plugins/jquery-screen-keyboard-plugin/#.UCTg6p1lTkd)为Kiosk创建屏幕键盘。它效果很好,但是我需要键盘出现在屏幕底部而不是输入/文本区域下方。虚拟键盘插件的位置

内外部jquery.keyboard.js文件,我发现以下几点:

$.keyboard.defaultOptions = { 

     // *** choose layout & positioning *** 
     layout  : 'qwerty', 
     customLayout : null, 

     position  : { 
      of : null, // optional - null (attach to input/textarea) or a jQuery object (attach elsewhere) 
      my : 'center top', 
      at : 'center top', 
      at2: 'center bottom' // used when "usePreview" is false (centers the keyboard at the bottom of the input/textarea) 
     }, 

我应该怎么使用,而不是“空”?这应该如何被添加到代码?

感谢

回答

5

对于of参数,只是针对文档窗口:$(window)

这里的a demo和代码:

$('#keyboard').keyboard({ 

    // Used by jQuery UI position utility 
    position: { 
     of: $(window), // null = attach to input/textarea; use $(sel) to attach elsewhere 
     my: 'center bottom', 
     at: 'center bottom', 
     at2: 'center bottom' // used when "usePreview" is false 
    } 

});​ 

由于这是一个小亭,你可能也想看看this demo其定位和调整大小的键盘。此外,键盘上添加上一个和下一个按钮...嗯,我发誓有一个前一个和下一个按钮。我需要更新该演示。

注意:我为virtual-keyboard添加了标签,因为我完全错过了这个问题。另外请务必查看documentation