-4

我已经在我的网站上实现了 touch-punch 插件,但我仍然无法将触控功能用于我的签名功能。当我在 Edge 上使用它时,触摸功能可能会在停止之前工作一秒钟。此外,对于普通的 Internet Explorer 来说,它工作得很好,但 Chrome 和 Firefox 根本无法使用触摸打孔。

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/south-street/jquery-ui.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"></script>
<link href="<?php echo plugins_url(); ?>/booking/css/jquery.signature.css" rel="stylesheet">
<script src="<?php echo plugins_url(); ?>/booking/js/jquery.signature.js"></script>
<script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
<script src="jquery.ui.touch-punch.min.js"></script>

签名代码:

 <script>
   $(function() {
        $('#sig'+"<?php echo $row->bookingid; ?>").signature({
            guideline: true, 
            guidelineOffset: 25, 
            guidelineIndent: 20, 
            guidelineColor: '#ff0000',
                change: function(event, ui) { 
                    var jsonval = $(this).signature('toJSON');
                    $("#signcanvas"+"<?php echo $row->bookingid; ?>").val(jsonval);
    }
            });  
   });
  </script>
4

1 回答 1

-1

所以我的 touch-punch 插件路径不正确。jquery.ui.touch-punch.min.js在我的 中找到文件的正确路径后CPanel,我更改了代码中的路径并能够利用触摸功能。还要确保定义了脚本的类型。

例如:添加type=text/javascript, 也是插件运行所必需的。

于 2016-03-06T01:46:48.533 回答