如何在wordpress中实现签名板

时间:2017-09-20 17:21:37

标签: javascript jquery wordpress

我正试图让我的wordpress页面显示签名板。

我转到https://github.com/szimek/signature_pad并安装脚本。但是在wordpress中没有任何东西呈现。有没有一种特定的方法让js在wordpress中工作?

这是一个js小提琴链接:https://jsfiddle.net/szimek/jq9cyzuc/

*我已将以下内容添加到标题中,并将html添加到正文中(没有任何反应):

放置以下html

= link_to 'Reject And Exit', destroy_user_session_path, :class => "btn btn-warning btn-lg, method: delete"

<div id="signature-pad" class="signature-pad">
<div class="signature-pad--body">
  <canvas></canvas>
</div>
<div class="signature-pad--footer">
  <div class="description">Sign above</div>

  <div class="signature-pad--actions">
    <div>
      <button type="button" class="button clear" data-action="clear">Clear</button>
      <button type="button" class="button" data-action="change-color">Change color</button>
      <button type="button" class="button" data-action="undo">Undo</button>

    </div>
    <div>
      <button type="button" class="button save" data-action="save-png">Save as PNG</button>
      <button type="button" class="button save" data-action="save-jpg">Save as JPG</button>
      <button type="button" class="button save" data-action="save-svg">Save as SVG</button>
    </div>
  </div>
</div>

1 个答案:

答案 0 :(得分:2)

我创建了签名代码,工作正常。看一下demo。

&#13;
&#13;
<div id="signature-pad" class="signature-pad">
    <div class="signature-pad--body">
      <canvas width="664" height="235" style="touch-action: none;"></canvas>
    </div>
    <div class="signature-pad--footer">
      <div class="description">Sign above</div>

      <div class="signature-pad--actions">
        <div>
          <button type="button" class="button clear" data-action="clear">Clear</button>
          <button type="button" class="button" data-action="change-color">Change color</button>
          <button type="button" class="button" data-action="undo">Undo</button>

        </div>
        <div>
          <button type="button" class="button save" data-action="save-png">Save as PNG</button>
          <button type="button" class="button save" data-action="save-jpg">Save as JPG</button>
          <button type="button" class="button save" data-action="save-svg">Save as SVG</button>
        </div>
      </div>
    </div>
  </div>
  
<script src="https://szimek.github.io/signature_pad/js/signature_pad.js"></script>
<script src="https://szimek.github.io/signature_pad/js/app.js"></script>
&#13;
&#13;
&#13;