HTML5 canvas 在线涂鸦
程序员文章站
2022-06-19 18:26:33
插件地址 http://bencentra.github.io/jq signature/ 采用技术 jq signature.min.js Developed using jQuery 2.1.4. 截图 " " ......
插件地址
采用技术
- jq-signature.min.js
- developed using jquery 2.1.4.
<!doctype html> <html> <head> <meta charset="utf-8"> <title>insert title here</title> <script src="jquery.min.js"></script> <script src="jq-signature.min.js"></script> <script> $(function(){ $('.js-signature').jqsignature(); }) function clearcanvas() { $('#signature').html('<p><em>your signature will appear here when you click "save signature"</em></p>'); $('.js-signature').eq(1).jqsignature('clearcanvas'); $('#savebtn').attr('disabled', true); } function savesignature() { $('#signature').empty(); var dataurl = $('.js-signature').jqsignature('getdataurl'); var img = $('<img>').attr('src', dataurl); $('#signature').append($('<p>').text("here's your signature:")); $('#signature').append(img); } $('.js-signature').eq(1).on('jq.signature.changed', function() { $('#savebtn').attr('disabled', false); }); </script> </head> <body> <div class="js-signature" data-width="600" data-height="200" data-border="1px solid black" data-line-color="#bc0000" data-auto-fit="true"></div> <p><button id="clearbtn" class="btn btn-default" onclick="clearcanvas();">clear canvas</button> <button id="savebtn" class="btn btn-default" onclick="savesignature();" >save signature</button></p> <div id="signature"> <p><em>your signature will appear here when you click "save signature"</em></p> </div> </body> </html>
截图
上一篇: html前端登录验证
下一篇: 简单改造丨让你的博客园焕然一新