没弄过扫描枪,不过猜测是否系统就是将它认为是键盘??如果是的花那么下面的改进的代码应该可以。
.field {
height:30px;
width:200px;
border: 1px solid ;
padding:5px;
line-height: 30px;
}
.field .pointer {
height:100%;
}
.field .pointer.focus {
border-left: 1px solid;
}
(function($){
var flash = null;
var flashFn = function(domObj){
console.log(domObj);
if(flash !== null){
return ;
}
console.log(flash);
flash = setInterval(function( ){
console.log('Flashing... ' ( new Date()));
if(domObj.hasClass('focus')){
domObj.removeClass('focus');
}else{
domObj.addClass('focus');
}
}, 600);
}
flashFn($('.field .pointer'));
$('#temp').focus();
$('#ipt').on('click', function(e){
clearInterval(flash);
$('#temp').focus();
$(this).html('
})
$('#temp').on('keyup', function(e){
clearInterval(flash);
var val = $('#ipt').text();
val = e.key;
$('#ipt').text(val);
console.log(e.key);
})
})(Zepto);