forked from boblemarin/jQuery.eraser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
159 lines (135 loc) · 4.29 KB
/
index.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name='HandheldFriendly' content='True' />
<!-- <meta name='viewport' content='initial-scale=1.0; maximum-scale=1.0; user-scalable=0;' /> -->
<meta name='viewport' content='user-scalable=0' />
<meta name="viewport" content="width=device-width" />
<title>jQuery.eraser, a plugin that makes an image erasable (touch & mouse)</title>
<style type="text/css">
* {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
/* make transparent link selection, adjust last value opacity 0 to 1.0 */
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
/* -webkit-tap-highlight-color: rgba(0,0,0,0); */
}
body {
background: #FFF;
color: #000;
margin: 5px;
padding: 0px;
margin-bottom: 45px;
text-align: center;
font-family: Helvetica, Arial;
}
a {
color: #000;
}
.box {
display: inline-block;
color: #FFF;
background: #000;
padding: 10px;
margin: 10px;
cursor: pointer;
}
.box:hover {
background: #444;
}
.big {
font-size: 2em;
display: inline-block;
margin: 10px;
}
.container {
position: relative;
display: inline-block;
width: 533px;
height: 800px;
}
#robot {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
-webkit-box-shadow: 0px 0px 20px 0px #707070;
-moz-box-shadow: 0px 0px 20px 0px #707070;
box-shadow: 0px 0px 20px 0px #707070;
}
#redux {
position: absolute;
top: 0px;
left: 0px;
z-index: 2;
}
#progress {
position: absolute;
top: 4px;
right: 4px;
color: black;
pointer-events: none;
z-index: 3;
text-shadow: 0px 0px 2px #FFFFFF;
}
small {
font-size: 12px;
color: #BBB;
font-weight: normal;
}
</style>
</head>
<body>
<h1>jQuery.eraser() <small> 0.5.1</small></h1>
<p>a plugin that replaces the targeted image by an interactive canvas <br/>that can be erased
using touch ou mouse moves.<br/><b>try by yourself below...</b></p>
<p><code id="percent">$("#myImage").eraser();</code></p>
<span class="container">
<img id="robot" src="img/robot.jpg" />
<img id="redux" src="http://minimal.be/lab/jQuery.eraser/img/robot_redux.png" />
<div id="progress">0%</div>
</span>
<p>
<div id="resetBtn" class="box"> RESET </div>
<div id="clearBtn" class="box"> CLEAR </div>
<div id="toggleBtn" class="box"> DISABLE </div>
</p>
<p><a href="https://github.com/boblemarin/jQuery.eraser" class="big">Download on github</a><br/> ... and <a href="http://minimal.be/@">follow boblemarin</a><br/>
<a href="teeth.htm">or brush his teeth</a>.</p>
<script src='http://code.jquery.com/jquery-2.1.1.min.js' type='text/javascript'></script>
<script src='jquery.eraser.js' type='text/javascript'></script>
<script type = "text/javascript">
$(function(){
$('#redux').eraser({
progressFunction: function(p) {
$('#progress').html(Math.round(p*100)+'%');
}
});
$('#resetBtn').click(function(event) {
$('#redux').eraser('reset');
$('#progress').html('0%');
event.preventDefault();
});
$('#clearBtn').click(function(event) {
$('#redux').eraser('clear');
$('#progress').html('100%');
event.preventDefault();
});
$('#toggleBtn').click(function(event) {
var $redux = $('#redux'),
$toggleBtn = $('#toggleBtn');
if ($redux.eraser('enabled')) {
$toggleBtn.text(' ENABLE ');
$redux.eraser('disable');
} else {
$toggleBtn.text(' DISABLE ');
$redux.eraser('enable');
}
event.preventDefault();
});
});
</script>
</body>
</html>