forked from lukewendling/try-sticky-position
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
120 lines (116 loc) · 2.28 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
117
118
119
120
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<link href="http://cdnjs.cloudflare.com/ajax/libs/normalize/2.1.3/normalize.min.css" rel="stylesheet" type="text/css" media="all">
<link href="fixedsticky.css" rel="stylesheet" type="text/css" media="all">
<title>position: sticky</title>
<style>
body {
margin: 0;
}
.sticky {
position: sticky;
top: 10px;
z-index: 1;
}
.fixedsticky {
top: 0px;
z-index: 1;
}
.col {
display: block;
width: 49%;
vertical-align: top;
}
.right {
position: relative;
top: 0;
left: 50%;
}
.lev1 {
background-color: blue;
}
.lev2 {
background-color: orange;
}
</style>
<body>
<div class='fixedsticky col lev1'>
A
</div>
<div class='col right'>
<div class='fixedsticky col lev2'>
1
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev2'>
2
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev2'>
3
</div>
<div class='col lorem right'>
content
</div>
</div>
<div class='fixedsticky col lev1'>
B
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev1'>
C
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev1'>
D
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev1'>
E
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev1'>
F
</div>
<div class='col lorem right'>
content
</div>
<div class='fixedsticky col lev1'>
G
</div>
<div class='col lorem right'>
content
</div>
<script src='lorem.js'></script>
<script src='http://codeorigin.jquery.com/jquery-1.10.2.js'></script>
<script src='fixedsticky.js'></script>
<script>
var lorem = new Lorem();
lorem.type = Lorem.TEXT;
lorem.query = '3p';
[].forEach.call(
document.querySelectorAll('.lorem'),
function (el) {
lorem.createLorem(el);
}
);
FixedSticky.tests.sticky = false; // turn off native for all
$('.fixedsticky').fixedsticky();
</script>
</body>
</html>