-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
44 lines (41 loc) · 1.35 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<title>CSSGrid Webcomponent Demo</title>
<link rel="import" href="./css-grid.html">
<style>
.container {
margin-top : 100px;
height: auto;
width: 200px;
background: cyan;
padding: 20px;
}
.isDraggable {
margin-top: 20px;
background: black;
color: white;
padding: 10px;
}
</style>
</head>
<body>
<css-grid
add-components-text="Try dragging and dropping components here"
in-edit-mode="true"></css-grid>
<div class="container">
<div class="isDraggable" draggable="true">h1</div>
<div class="isDraggable" draggable="true">section</div>
<div class="isDraggable" draggable="true">row-adder</div>
<div class="isDraggable" draggable="true">css-grid</div>
</div>
<script>
var draggableEl = document.querySelectorAll('.isDraggable');
for(var i = 0; i < draggableEl.length; i++) {
draggableEl[i].addEventListener('dragstart', (e)=>{
e.dataTransfer.setData('text', e.srcElement.innerText);
});
}
</script>
</body>
</html>