-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (77 loc) · 4.36 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
<!DOCTYPE html>
<html id="doc" style="width: 100%; height: 100%">
<head>
<title>Grid View Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale: 1, maximum-scale: 1">
<!--jQuery Mobile-->
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
function InitApp()
{
var gridHeight = 400;
var gridWidth = 500;
var scrollBarWidth = getScrollSizes(); //get scroll bar's width.
$("#div-header").css("width", (gridWidth - scrollBarWidth) + "px");
$("#div-header-hack").css("width", (scrollBarWidth) + "px");
$("#div-item").css("width", (gridWidth) + "px");
$("#div-header-hack").css("left", (gridWidth - scrollBarWidth) + "px");
$("#div-item").css("max-height", (gridHeight) + "px");
//add header and item divs, directly in HTML Or in javascript.
var header = '<div style="min-width: 1000px;">' +
'<div style="width: 120px; display: inline-block">Header 1</div>' +
'<div style="width: 180px; display: inline-block">Header 2</div>' +
'<div style="width: 120px; display: inline-block">Header 3</div>' +
'<div style="width: 190px; display: inline-block">Header 4</div>' +
'<div style="width: 250px; display: inline-block">Header 5</div>' +
'<div style="width: 120px; display: inline-block">Header 6</div>' +
'</div>';
//add header and item divs, directly in HTML Or in javascript.
var item = '<div style="min-width: 1000px; background-color: #D7BDEC; padding: 10px 0px 0px 0px; border-bottom: 1px solid gray">' +
'<div style="width: 120px; display: inline-block">Item 1</div>' +
'<div style="width: 180px; display: inline-block">Item 2</div>' +
'<div style="width: 120px; display: inline-block">Item 3</div>' +
'<div style="width: 190px; display: inline-block">Item 4</div>' +
'<div style="width: 250px; display: inline-block">Item 5</div>' +
'<div style="width: 120px; display: inline-block">Item 6</div>' +
'</div>';
$("#div-header").append(header);
for(var index = 0; index < 600; index ++)
{
$("#div-item").append(item);
}
}
function ScrollHeader()
{
$("#div-header").scrollLeft($("#div-item").scrollLeft());
}
//refernce - http://stackoverflow.com/questions/457262/html-what-is-the-height-of-a-horizontal-scrollbar
function getScrollSizes()
{
// call after document is finished loading
var el= document.createElement('div');
el.style.display= 'hidden';
el.style.overflow= 'scroll';
document.body.appendChild(el);
var h= el.offsetHeight-el.clientHeight;
document.body.removeChild(el);
return h;
}
</script>
</head>
<body id="doc-body" style="width: 100%; height: 100%; overflow: hidden; position: fixed" onload="InitApp()">
<div>
<!--If you don't need header background color you don't need this div.-->
<div id="div-header-hack" style="height: 20px; position: absolute; background-color: gray"></div>
<div id="div-header" style="position: absolute; top: 0px; overflow: hidden; height: 20px; background-color: gray">
</div>
<div id="div-item" style="position: absolute; top: 20px; overflow: auto" onscroll="ScrollHeader()">
</div>
<p> this is after new change and this change is after creating new local branch.
</p>'
<p> this change is in develop.</p>
</div>
<ul>
<li><a href="www.yahoo.com">Biography</a></li>
</ul>
</body>
</html>