According to the requirements, it is necessary to move up and down through the keyboard to obtain the value in the Lenovo menu, just like the query function of Google Baidu.
I have been searching online for a long time but could not find a plug-in that can achieve this function, so I had no choice but to change the code myself.
Find the KEY.DOWN and KEY.UP execution codes in js
as follows:
case KEY.DOWN:
event.preventDefault();
if ( select.visible() ) {
select.next();
}
else {
onChange(0, true);
}
break;
Add
var selected = select.selected();
var v = selected.result;
$input.val(v);
After adding this, there will be corresponding values in the input box when pressing the up and down keys, but the cursor on the Lenovo keyboard will disappear.
Find select.next(); The definition of the code
next: function() {
moveSelect(1);
},
Add a similar method
stay: function() {
moveSelect(1);
},
Then
case KEY.DOWN:
event.preventDefault ();
if ( select.visible() ) {
select.next();
var selected = select.selected();
var v = selected.result;
$ input.val(v);
select.stay();
}
else {
onChange(0, true);
}
break;
That’s it.
==================================
Thank you very much to the original author,
Add a similar method
stay: function() {
moveSelect(1);
}, and later found that clicking the up and down keys will move interlaced rows, so it was changed to:
stay: function() {
moveSelect(0) ;
},
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn