-
Notifications
You must be signed in to change notification settings - Fork 1
/
kgrid.html
81 lines (61 loc) · 1.52 KB
/
kgrid.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
<!DOCTYPE html>
<html>
<head>
<title>KGrid</title>
<style>
body {
font-family: Helvetica, Arial, sans-seris;
font-size: 10pt;
}
body a {
color: #d0d0d0;
}
.bold_text {
font-weight: bold;
}
.kgrid_image {
border: 1px solid #c0c0c0;
background-color: #a0a0a0;
}
.kgrid_cell {
/* border: 1px solid #ff0000; */
padding: 4px;
}
.kgrid_cell_floatprop {
float: left;
}
</style>
<script src="js/kmath.js"></script>
<script src="js/kgrid.js"></script>
<script>
// this is the id of the DOM element that Kgrid should render the grid into
var main_div_id = 'grid_target';
var kgrid = new KGrid;
function handle_onload() {
// display options for KGrid
var kgrid_opts = new KGridOptions;
kgrid_opts.num_panels = 2;
kgrid_opts.letterbox_panels = false;
kgrid_opts.panel_width = 200;
kgrid_opts.panel_height = 200;
kgrid_opts.single_cell_per_row = true;
// point KGrid at the target DOM element
kgrid.init(document.getElementById(main_div_id), kgrid_opts);
// set the data source for all the "cells in the grid"
var cells = [];
for (var i=0; i<12; i++) {
var str = "Item: " + i;
var cell = new KGridCell(["media/jojo_tall.jpg","media/jojo_tall_bw.jpg"], str);
cells.push(cell);
}
// this where the DOM gets updated to display the images
kgrid.generate_grid(cells);
}
</script>
</head>
<body onload="handle_onload()">
<div class="bold_text" style="font-size: 14pt;">KGrid Demo</div>
<div id="grid_target" style="width: 900px; border: 1px solid #000000;">
</div>
</body>
</html>