forked from alberon/jquery-cookie-banner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixed-top.html
106 lines (95 loc) · 3.26 KB
/
fixed-top.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
<html>
<head>
<style>
.cookie-banner {
box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: auto;
padding: 10px 32px;
background: #9BB720;
color: #fff;
text-align: center;
z-index: 999999;
box-shadow: 0 3px 5px rgba(0,0,0,0.3);
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.cookie-banner a {
color: #fff;
font-weight: 600;
}
.cookie-banner .cookie-close {
box-sizing: border-box;
display: inline-block;
margin-left: 32px;
padding: 7px 15px;
background: #e3e3e3;
border-radius: 0.3em;
border: 3px solid rgba(0,0,0,0.15);
color: #9BB720;
font-weight: 600;
cursor: pointer;
transition: background 0.3s;
}
.cookie-banner .cookie-close:hover {
background: #fff;
}
body.cookie-banner-active {
top: 65px;
position: relative;
transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
will-change: top;
}
@media screen and (max-width: 1253px){
body.cookie-banner-active {
top: 90px;
}
}
@media screen and (max-width: 605px){
body.cookie-banner-active {
top: 106px;
}
}
@media screen and (max-width: 447px){
body.cookie-banner-active {
top: 128px;
}
}
@media screen and (max-width: 359px){
body.cookie-banner-active {
top: 150px;
}
}
</style>
<script src="../dist/cookie-banner.pkgd.min.js"></script>
</head>
<body>
<script>
(function($){
$(function(){
$('body').cookieBanner({
animate: {
close: function(e){
$('body').css({
'top': '0'
});
$('.cookie-banner').css({
'transform': 'translate3d(0, -100%, 0)'
});
setTimeout(function(){
$('body').removeClass('cookie-banner-active')
.find('.cookie-banner').remove();
}, 310);
}
},
link: {
url: '/privacy-policy'
}
});
});
})(jQuery);
</script>
</body>
</html>