Her*_*der 3 javascript jquery jquery-ui jquery-plugins barcode-scanner
在我继承的webapp中,有一些jquery代码可以捕获条形码扫描(简单的一维条码,如健身俱乐部和杂货店使用 - 没有QR码,没有异国情调等).但实现它的方式需要一个模态框来设置一个微调器,然后你扫描,它的工作原理.我们的客户不喜欢这样.他们希望能够从应用程序中的任何网页扫描条形码,而不必转到某个页面并在扫描之前出现模式窗口,阻止其他所有内容.
我感兴趣地看了这个:https://github.com/julien-maurel/jQuery-Scanner-Detection(我无法让它工作.)我在网页上尝试过这个:
<script type="text/javascript" src="Scripts/barcode/jquery.scannerdetection.js"></script>
<script>
$(window).bind('scannerDetectionComplete', function (e, data) {
alert(e);
alert(data);
})
</script>
Run Code Online (Sandbox Code Playgroud)
我也试过$(document).bind(...)代替
实际的源文档只是说$(selector).scannerDetection();它们没有给出实际用法的例子.
我真的不在乎我是否使用这个jquery插件,一些其他jquery插件,自定义jquery或一些原始的javascript代码片段 - 我只需要能够从任何网页检测条形码扫描而不需要求助于模态监听器的东西.如果有人知道如何使用"jQuery-Scanner-Detection"插件(如上所述),我也很乐意尝试.谢谢.
文件准备好;)
jQuery(document).ready(function($) {
$(window).scannerDetection();
$(window).bind('scannerDetectionComplete',function(e,data){
alert('complete '+data.string);
})
.bind('scannerDetectionError',function(e,data){
console.log('detection error '+data.string);
})
.bind('scannerDetectionReceive',function(e,data){
console.log(data);
})
$(window).scannerDetection('success');
});
Run Code Online (Sandbox Code Playgroud)