-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex2.html
executable file
·74 lines (70 loc) · 3.19 KB
/
index2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html lang="zh">
<style>
html,body{
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
</style>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>用户签名</title>
</head>
<body>
<div class="htmleaf-container" style="height: 100%;overflow: hidden">
<div class="container" style="height: 100%;">
<div class="row" style="height: 100%;">
<div class="col-xs-12" style="width: 100%;height: 100%; ">
<div style="width: 100%;height: 100%;" class="js-signature" data-width="100%" data-border="1px solid black" data-line-color="#bc0000" data-auto-fit="true"></div>
<p style="display: inline-block;position: absolute;left: -20px;top:50%;margin-top: -12.5px; transform: rotate(90deg)">
<button id="returnBtn" class="btn btn-default" onclick="returnCanvas();">返回</button>
<button id="clearBtn" class="btn btn-default" onclick="clearCanvas();">清除</button>
<button id="saveBtn" class="btn btn-default" onclick="saveSignature();" disabled>签名</button>
</p>
<div style="width: 400px;height: 200px;line-height: 0; text-align: center;position: absolute;left: 50%;top: 50%;margin-left: -200px;margin-top: -100px;transform: rotate(90deg);font-size: 5em;color: #ededed;z-index: -999">
<p>在此处签名</p>
</div>
</div>
</div>
</div>
</div>
<script src="js/jquery-1.11.0.min.js"></script>
<script src="js/jq-signature.js"></script>
<script type="text/javascript">
document.body.addEventListener('touchmove', function (e) {
e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
}, {passive: false}); //passive 参数不能省略,用来兼容ios和android
$(document).on('ready', function () {
$('.js-signature').jqSignature({
height: $(document).height()-2,
background: 'transparent'
});
// $('.js-signature').children().css('width','80%');
// $('.js-signature').children().css('height',$(document).height()-2);
// console.log($('.js-signature').children());
});
function clearCanvas() {
// $('#signature').html('<p><em>Your signature will appear here when you click "Save Signature"</em></p>');
$('.js-signature').jqSignature('clearCanvas');
$('#saveBtn').attr('disabled', true);
}
function returnCanvas() {
history.back();
}
function saveSignature() {
// $('#signature').empty();
// var dataUrl = $('.js-signature').jqSignature('getDataURL');
// var img = $('<img>').attr('src', dataUrl).attr('style','display:block');
// $('#signature').append($('<p>').text("Here's your signature:"));
// $('#signature').append(img);
}
$('.js-signature').on('jq.signature.changed', function () {
$('#saveBtn').attr('disabled', false);
});
</script>
</body>
</html>