forked from ryanbressler/ResizableGridStub
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
116 lines (96 loc) · 4.97 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
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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>ResizableGridStub :: hrovira :: Gridster+JqueryUI Resizeable Demo</title>
<meta name="description" content="">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="http://genespot.cancerregulome.org/css/app.css" />
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="vendor/jquery.gridster.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="vendor/jquery.gridster.min.css">
<script type="text/javascript">
var layout;
var grid_size = 100;
var grid_margin = 4;
function resizeBlock(elmObj) {
var elmObj = $(elmObj);
var w = elmObj.width() - grid_size;
var h = elmObj.height() - grid_size;
for (var grid_w = 1; w > 0; w -= (grid_size + (grid_margin * 2))) {
grid_w++;
}
for (var grid_h = 1; h > 0; h -= (grid_size + (grid_margin * 2))) {
grid_h++;
}
layout.resize_widget(elmObj, grid_w, grid_h);
}
function fetchMock(mockId, $el) {
console.log("fetchMock(" + mockId + ")");
$.ajax({
"url": "mock_atlas/" + mockId + ".html",
"type": "GET",
"success": function(o) {
$el.html(o);
}
});
}
$(document).ready(function () {
layout=$(".gridster ul").gridster({
widget_margins: [grid_margin, grid_margin],
widget_base_dimensions: [grid_size, grid_size],
shift_larger_widgets_down: true
}).data('gridster');
$(".gridster ul").children('li').each(function(i,v) {
console.log("making element resizable")
$(v).resizable({
grid: [grid_size + (grid_margin * 2), grid_size + (grid_margin * 2)],
minWidth: grid_size,
minHeight: grid_size,
autoHide: true,
stop: function(event, ui) {
var resized = $(this);
setTimeout(function() {
resizeBlock(resized);
}, 300);
}
})
});
$('.ui-resizable-handle').hover(function() {
layout.disable();
}, function() {
layout.enable();
});
fetchMock("mutsig_ranks", $(".mutsig-ranks"));
fetchMock("sample_distributions", $(".sample-distributions"));
});
</script>
</head>
<body>
<div class="gridster">
<ul style="position: relative;">
<li data-row="1" data-col="1" data-sizex="7" data-sizey="7" class="gs_w sample-distributions">1</li>
<li data-row="1" data-col="2" data-sizex="5" data-sizey="4" class="gs_w">2</li>
<li data-row="1" data-col="3" data-sizex="6" data-sizey="5" class="gs_w mutsig-ranks">3</li>
<li data-row="1" data-col="4" data-sizex="4" data-sizey="4" class="try gs_w">4</li>
<li data-row="1" data-col="5" data-sizex="4" data-sizey="4" class="gs_w">5</li>
<li data-row="2" data-col="1" data-sizex="4" data-sizey="4" class="gs_w">6</li>
<li data-row="2" data-col="2" data-sizex="4" data-sizey="2" class="gs_w">7</li>
<li data-row="3" data-col="1" data-sizex="4" data-sizey="5" class="gs_w">8</li>
<li data-row="3" data-col="2" data-sizex="6" data-sizey="3" class="gs_w">9</li>
</ul>
</div>
<div class="content">
<p>Demo for resizable grid layout based on <a href="https://github.com/dustmoo/gridster.js/">dust moo's fork of gridster.js</a>, <a href="http://api.jqueryui.com/resizable/">jqueryui resizable</a> and <a href="http://jsfiddle.net/PrtrR/2/embedded/">this js fiddle</a></p>
</div>
</body>
</html>