forked from motine/css_grid_annotator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
78 lines (69 loc) · 2.27 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
<!DOCTYPE html>
<html>
<head>
<title>Grid Annotator</title>
<style type="text/css">
.container {
background-color: antiquewhite;
display: grid;
display: -ms-grid;
grid-template-columns: 1fr 1fr;
-ms-grid-columns: 1fr 1fr;
}
.elm {
background-color: rgba(0, 0, 255, 0.3);
margin: 10px;
padding: 10px;
}
.hidden {
display: none;
}
.item1 { grid-column: 1; grid-row: 1; -ms-grid-column: 1; -ms-grid-row: 1; }
.item2 { grid-column: 2; grid-row: 1; -ms-grid-column: 2; -ms-grid-row: 1; }
.item3 { grid-column: 1; grid-row: 2; -ms-grid-column: 1; -ms-grid-row: 2; }
.item4 { grid-column: 2; grid-row: 2; -ms-grid-column: 2; -ms-grid-row: 2; }
</style>
</head>
<body>
<h1>Examples</h1>
<h2>Overflowing items are added to new rows</h2>
<div class="container">
<div class="elm">Lorem A</div>
<div class="elm">Ipsum B</div>
<div class="elm">Dolor C</div>
<div class="elm">Sit D</div>
<div class="elm">Amet E</div>
</div>
<h2>Hidden markup is not considered</h2>
This should render as above, even though there is a hidden input and a hidden div in the container
<div class="container">
<input type="hidden">
<div class="elm">Lorem A</div>
<div class="elm">Ipsum B</div>
<div class="hidden">Dolor C</div>
<div class="elm">Dolor C</div>
<div class="elm">Sit D</div>
<div class="elm">Amet E</div>
</div>
<h2>If any element has specific positions annotated, we leave it alone</h2>
You should see the elements in the right order (left->right, top->bottom).
<div class="container">
<div class="elm item4">4</div>
<div class="elm item2">2</div>
<div class="elm item1">1</div>
<div class="elm item3">3</div>
</div>
<h2>Annotate dynamic content</h2>
Only works for whole containers...
<script type="text/javascript">
/* eslint-disable */
function appendGrid() {
var demoContainer = document.querySelector("#dyndemo1");
demoContainer.innerHTML = '<div class="container"><div class="elm">Lorem A</div><div class="elm">Ipsum B</div></div>';
}
</script>
<button onclick="appendGrid()">add a grid</button>
<div id="dyndemo1"></div>
<script type="text/javascript" src="css_grid_annotator.js"></script>
</body>
</html>