-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
36 lines (30 loc) · 983 Bytes
/
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
<body>
<table id="foo" style="display:block;">
</table>
<script src="dist/micro-virtual-list.js"></script>
<script type="text/javascript">
const container = document.getElementById('foo')
const total = 200000
const itemHeight = 70
const heights = new Array(total).fill(0).map((e) => Math.floor(Math.random() * (20 - 70) + 70))
const config = {
total: total,
itemHeight: itemHeight,
height: 400,
getRow: (i) => {
const el = document.createElement('tbody')
const tr = document.createElement('tr')
const td = document.createElement('td')
td.innerText = 'Row: ' + i + ' ( '+heights[i]+'px )'
tr.appendChild(td)
el.appendChild(tr)
return {element: el, height: heights[i]}
}
}
const list = MicroVirtualList(container, config)
window.onresize = function() {
config.height = window.innerHeight - 100
list.refresh(config)
}
</script>
</body>