2017-03-08 59 views
1

我已經使用jQuery的虛擬鍵盤,我想顯示在文本字段頂部的鍵盤。我試圖通過立場。如何在輸入欄頂部移動虛擬鍵盤?

JQuery的

$('#test').keyboard({ layout: 'qwerty', usePreview: false,position: { 
     // null = attach to input/textarea; 
     // use $(sel) to attach elsewhere 
     of: null, 
     my: 'left top', 
     at: 'left top', 
     // used when "usePreview" is false 
     at2: 'left top' 
} }); 

HTML

<p style="height:200px" > 
content 
</p> 
<input type="text" class="form-control" id="test" placeholder="test" autocomplete="off"> 

這裏是演示網址http://jsfiddle.net/bhumi/rzrjw15h/1/

我也試圖設置位置一樣

position : { 
      of : '#searchterms',  // when null, element will default to kb.$keyboard 
      my : 'top', // 'center top', (position under keyboard) 
      at : 'top-200', // 'center bottom', 

     } 

回答

1

看到輸入字段的jsfiddle

$('#test').keyboard({ layout: 'qwerty', usePreview: false, 
    position: { 
    my: 'center bottom', 
    at: 'center bottom', 
    // used when "usePreview" is false 
    at2: 'center top' 
    } 
}); 
1

Working Fiddle

嘗試:

$('#test').keyboard({ 
    layout: 'qwerty', 
    usePreview: false, 
    position: { 
    of: null, 
    at2: 'top-100' 
    } 
}); 
+0

位置從頂部是動態的,這個改變時不工作 –