Giter Site home page Giter Site logo

jpgaus / canvassignature Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuyongsky123/canvassignature

0.0 1.0 0.0 12 KB

canvasSignature是基于html5 canvas及jquery实现手写签名(电子签名)功能的js组件

Home Page: http://www.shdnfw.com/plugin/canvasSignature/index.html

CSS 25.10% HTML 44.43% JavaScript 30.47%

canvassignature's Introduction

canvasSignature是基于html5 canvas及jquery实现手写签名(电子签名)功能的js组件


1、开始工作:

需要最先引入jquery (Bootstrap中文网开源项目免费 CDN 服务):

```html <script type="text/javascript" src="//cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script> ```

我们需要在页面中引入关键js:

```html <script type="text/javascript" src="....../canvasSignature.js"></script> ```

2、使用:

html:

(html canvas签名框准备,id为test可自定义)

```html 您的浏览器当前不支持canvas画布,请更换别的浏览器进行签名操作 ```

js(相应的方法调用):

初始化签名样式(这里仅支持一个签名,如需多个签名框需改写组件)

```javascript $('#test').canvasSignature({ fillStyle:'transparent', //生成图片背景色,默认为透明 lineWidth:10, //笔画粗细(尺寸),默认为四像素粗细 strokeStyle:'red' //笔画颜色,默认为黑色 }); ```

清除重写

```javascript $('#test').clearSignature(); ```

生成图片(生成图片格式base64包括:jpg、png格式)

```javascript $('#test').createSignature('png'); ```

3、方法说明:

方法名 参数 说明
canvasSignature fillStyle:生成图片背景色,默认为透明(字符串)
lineWidth:笔画粗细(尺寸),默认为四像素粗细(数字)
strokeStyle:笔画颜色,默认为黑色(字符串)
注意:参数是以对象形式传入,如:
$('#test').canvasSignature({
    fillStyle:'transparent',	//生成图片背景色,默认为透明
    lineWidth:10,	//笔画粗细(尺寸),默认为四像素粗细
    strokeStyle:'red'	//笔画颜色,默认为黑色
});
初始化签名框(主要)
clearSignature 清除签名
createSignature 生成图片格式base64包括:jpg、png格式(默认可不填)(字符串)
注意:参数是以字符串形式传入,如:
$('#signName').createSignature('png');
生成图片

4、兼容性:

兼容IE9及以上浏览器(支持canvas标签功能的浏览器)

canvassignature's People

Contributors

xuyongsky123 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.