"Back to top"
Bootstrap 4.1.1 Snippet by psomankar11

1
2
3
4
5
6
7
8
9
10
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="row">
<div id="BackToTop" style="">></div>
</div>
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*************************back to top****************************/
div#BackToTop {
position: fixed;
right: 10px;
bottom: 10px;
height: 40px;
width: 40px;
text-align: center;
line-height: 40px;
font-size: 20px;
background:#40979f;
border-radius: 50px;
color: #fff;
cursor: pointer;
}
a{
text-decoration: none !important;
}
/*************************back to top****************************/
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
$(window).scroll(function () {
if ($(this).scrollTop()) {
$('#BackToTop').fadeIn();
} else {
$('#BackToTop').fadeOut();
}
});
$("#BackToTop").click(function () {
$("html, body").animate({
scrollTop: 0
}, 1000);
});
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: