-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdd-dragimage.html
241 lines (214 loc) · 10.8 KB
/
dd-dragimage.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>HTML5 Fundamentals</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="img/favicon.png">
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="css/site.css" type="text/css" />
<link rel="stylesheet" href="js/highlight/styles/github.css" />
<script src="js/modernizr.min.js" type="text/javascript"></script>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/bootstrap.js" type="text/javascript"></script>
<script src="js/highlight/highlight.pack.js" type="text/javascript"></script>
<script src="js/app.js" type="text/javascript"></script>
</head>
<body>
<main>
<header>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img src="img/html5-fundamentals.png" title="HTML5 Fundamentals" class="hidden-sm" />
<img src="img/html5.png" title="HTML5 Fundamentals" class="visible-sm" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="example.html" class="nav-link">Example</a></li>
<li class="separator visible-md visible-lg">|</li>
<li><a href="selection.html" class="nav-link">Selection</a></li>
<li>
<div class="dropdown">
<span class="nav-link" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Forms<span class="caret"></span>
</span>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li><a href="forms-markup.html">Forms</a></li>
<li><a href="forms-pseudo-classes.html">Pseudo Classes</a></li>
<li><a href="forms-validation.html">Native Validation</a></li>
<li><a href="forms-validation-custom.html">Custom Validation</a></li>
<li><a href="forms-validation-bootstrap.html">Bootstrap Module</a></li>
</ul>
</div>
</li>
<li>
<div class="dropdown">
<span class="nav-link" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Media<span class="caret"></span>
</span>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li><a href="media-basics.html">Basics</a></li>
<li><a href="media-scripted.html">Scripted Controls</a></li>
<li><a href="media-dynamic.html">Dynamic Load</a></li>
</ul>
</div>
</li>
<li>
<div class="dropdown">
<span class="nav-link" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Canvas<span class="caret"></span>
</span>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li><a href="canvas-basics.html">Basics</a></li>
<li><a href="canvas-manipulation.html">Manipulation</a></li>
<li><a href="canvas-clipping.html">Clipping</a></li>
<li><a href="canvas-charts.html">Charts</a></li>
<li><a href="canvas-video.html">Video</a></li>
</ul>
</div>
</li>
<li>
<div class="dropdown">
<span class="nav-link" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Drag & Drop<span class="caret"></span>
</span>
<ul class="dropdown-menu" aria-labelledby="dLabel">
<li><a href="dd-basics.html">Basics</a></li>
<li><a href="dd-effects.html">Effects</a></li>
<li><a href="dd-datatransfer.html">Data Transfer Types</a></li>
<li><a href="dd-files.html">Files</a></li>
</ul>
</div>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
</header>
<article id="content-container" class="container">
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs code-tabs" role="tablist">
<li role="presentation" class="active"><a href="#content-tab" aria-controls="content" role="tab" data-toggle="tab">Content</a></li>
<li role="presentation"><a href="#markup-tab" aria-controls="markup" role="tab" data-toggle="tab">Markup</a></li>
<li role="presentation"><a href="#css-tab" aria-controls="profile" role="tab" data-toggle="tab">CSS</a></li>
<li role="presentation"><a href="#javascript-tab" aria-controls="messages" role="tab" data-toggle="tab">JavaScript</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="content-tab">
<div id="example-container">
<!-- example markup -->
<div id="target" class="well">
<h4>Drop Here</h4>
</div>
<div id="source" draggable="true" class="well">
<h4>Drag Me</h4>
</div>
<img src="img/arrow-up.png" id="drag-image" />
<!-- /example markup -->
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="markup-tab">
<pre><code class="html hljs"><div id="target" class="well">
<h4>Drop Here</h4>
</div>
<div id="source" draggable="true" class="well">
<h4>Drag Me</h4>
</div>
<img src="img/arrow-up.png" id="drag-image" /></code></pre>
</div>
<div role="tabpanel" class="tab-pane fade" id="css-tab">
<pre><code class="css hljs">/* none */</code></pre>
</div>
<div role="tabpanel" class="tab-pane fade" id="javascript-tab">
<pre><code class="javascript hljs">var cancel = function(e) {
if (e.preventDefault) {
e.preventDefault();
}
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
};
var dragStart = function(e) {
var img = document.getElementById('drag-image');
e.dataTransfer.setDragImage(img, -15, 15);
try {
e.dataTransfer.setData('text/plain', '');
} catch (e) {
e.dataTransfer.setData('Text', '');
}
};
var target = document.getElementById('target');
target.addEventListener('drop', cancel, false);
target.addEventListener('dragenter', cancel, false);
target.addEventListener('dragover', cancel, false);
var source = document.getElementById('source');
source.addEventListener('dragstart', dragStart, false);</code></pre>
</div>
<!-- -------------------------------------------------------------------- -->
<script>
var cancel = function(e) {
if (e.preventDefault) {
e.preventDefault();
}
if (e.stopPropagation) {
e.stopPropagation();
}
return false;
};
var dragStart = function(e) {
var img = document.getElementById('drag-image');
e.dataTransfer.setDragImage(img, -15, 15);
try {
e.dataTransfer.setData('text/plain', '');
} catch (e) {
e.dataTransfer.setData('Text', '');
}
};
var target = document.getElementById('target');
target.addEventListener('drop', cancel, false);
target.addEventListener('dragenter', cancel, false);
target.addEventListener('dragover', cancel, false);
var source = document.getElementById('source');
source.addEventListener('dragstart', dragStart, false);
</script>
</div>
</div>
</div>
</div>
</article>
<footer>
<div class="container">
<div class="row push-down-top-lg hidden-xs">
<div class="col-xs-offset-2 col-xs-3">
<img src="img/html5-fundamentals.png" title="HTML5 Fundamentals" />
<p>by <a href="http://craigshoemaker.net">Craig Shoemaker</a></p>
<p class="lead"><a href="http://twitter.com/craigshoemaker">Craig Shoemaker</a> is a <a href="http://www.infragistics.com">developer</a>,
<a href="http://www.pluralsight.com/author/craig-shoemaker">instructor</a>, <a href="http://code-magazine.com/SearchResults.aspx?search=craig%20shoemaker">writer</a>, <a href="http://polymorphicpodcast.com">podcaster</a>, and a man of many hats at <a href="http://www.infragistics.com">Infragistics</a>.</p>
<div class="push-down-top-md">
<a href="https://www.pluralsight.com/courses/html5-fundamentals"><img src="img/pluralsight.png" title="HTML5 Fundamentals" /></a>
</div>
</div>
<div class="col-xs-offset-1 col-xs-3">
<a href="http://craigshoemaker.net"><img src="img/craig-shoemaker.png" class="img-responsive" title="Craig Shoemaker" /></a>
</div>
</div>
</div>
</footer>
</main>
</body>
</html>