1、在页面中设置一个div,引用所有css以及js文件;
<link rel="stylesheet" href="css/base.css"> <link rel="stylesheet" href="css/canvas-board.css"> <link rel="stylesheet" href="css/clip.css"> <link rel="stylesheet" href="css/image-clip.css"> <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script> <script src="js/canvasBoard.js"></script> <script src="js/image-clip.js"></script> <script src="js/fileinput.js"></script> <script src="js/exif.js"></script>
2、设置点击事件并通过
var cav = new CanvasBoard("canvas-container", "");cav.init();
调用插件
3、设置一个img标签放生成的图片
<img src="" alt="" id="imgBox" width="1024" height="auto" />
4、文件下载后若要调试,可将js文件中两段代码注释掉即可。(如下)
$("*").keydown(function(e) { //判断按键 e = window.event || e || e.which; if (e.keyCode == 123) { e.keyCode = 0; return false; } }); $(document).bind("contextmenu", function(e) { return false; });