forked from bbarakaci/fixto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev3.html
55 lines (40 loc) · 1.04 KB
/
dev3.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
<!DOCTYPE html>
<html>
<head>
<title>fixto, a jQuery plugin for sticky positioning</title>
<script src="libs/jquery/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="src/fixto.js" type="text/javascript" charset="utf-8"></script>
<style>
body {
height: 2000px;
}
.sticky {
background-color: red;
}
</style>
</head>
<body>
<div class="sticky">
sticky
<button class="stop">Stop</button>
<button class="start">Start</button>
<button class="destroy">Destroy</button>
</div>
<script>
$(function() {
var child = $('.sticky')[0];
var parent = $('body')[0];
var instance = window.fixto.fixTo(child, parent);
$('.stop').click(function () {
instance.stop();
});
$('.start').click(function () {
instance.start();
});
$('.destroy').click(function () {
instance.destroy();
});
});
</script>
</body>
</html>