-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
53 lines (52 loc) · 1.27 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="jquery.fixtop.js"></script>
<title>jQuery plugin</title>
<style type="text/css">
.bar{
text-align: center;
margin-bottom: 10px;
background-color: #f5f5f5;
padding: 5px;
border: 1px solid #ddd;
-webkit-transition: opacity 0.3s;
-webkit-transition: background-color 0.3s;
}
.fake{
height: 500px;
background: gray;
}
</style>
</head>
<body>
<div class="fake"></div>
<div class="fake"></div>
<div class="bar" id="myBar">
My fixed bar
</div>
<div class="fake"></div>
<div class="fake"></div>
<script type="text/javascript">
$(function(){
$("#myBar").fixtop({
marginTop: 10,
fixed: function(el){
el.css({
"opacity": 0.7,
"background-color": "#5c5c5c"
});
},
unfixed: function(el){
el.css({
"opacity": 1,
"background-color": "#f5f5f5"
});
}
});
});
</script>
</body>
</html>