"sticky header scroll top"
Bootstrap 3.0.0 Snippet by fahim525

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
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="wrapper">
<header>
<div class="container">
<div id="logo">Logo Here</div>
<nav>
<a href="#">Home</a>
<a href="#">Blog</a>
<a href="#">Courses</a>
<a href="#">Jobs</a>
<a href="#">Contact</a>
</nav>
</div>
</header>
<a id="scrollToTop" class="hide" href="#"><i class="fa fa-arrow-circle-up"></i></a>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
@import url("https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css");
html,body{
padding: 0px;
margin:0px;
width: 100%;
}
.wrapper{
width:100%;
height:auto;
padding: 0;
margin:0;
overflow:hidden;
min-height:2000px;
}
header{
width:100%;
height:80px;
color: #fff;
background:#446cB3;
line-height:80px;
position: fixed;
top: 0;
transition: all 0.5s ease;
box-shadow: 0px 2px 10px #fff inset;
}
.container{
width: 100%;
max-width: 1024px;
margin: 0 auto;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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
/*Head animatioon change JQuery code below*/
$(document).on('scroll',function(){
if($(this).scrollTop() > 1){
$('header').addClass('stivky');
}
else{
$('header').removeClass('stivky');
}
});
/*top botton Scroll to top animatioon change JQuery code below*/
$(document).on('click','#scrollToTop',function(){
$('html,body').animate({scrollTop:0},500);
return false;
});
/*top botton show/hide animatioon change JQuery code below*/
$(document).scroll(function(e){
var scrollpos = $(this).scrollTop();
if(scrollpos <500){
$('#scrollToTop').addClass('hide');
}
else{
$('#scrollToTop').removeClass('hide');
}
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: