"Scroll Top"
Bootstrap 3.3.0 Snippet by foysal991

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.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 ----------> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> <div class="container"> <div class="row"> <span class="scrolltotop"><i class="fa fa-chevron-up"></i></span> </div> </div> <script> $('.scrolltotop').on('click', function() { $('html, body').animate({ scrollTop: 0 }, 800); return false; }); $(document).scroll(function() { var y = $(this).scrollTop(); if (y > 300) { $('.scrolltotop').fadeIn(); } else { $('.scrolltotop').fadeOut(); } }); </script>
.container{ min-height: 1000px; } .scrolltotop { border: 2px solid red; border-radius: 50%; bottom: 40px; color: #fff; cursor: pointer; display: block; font-size: 20px; height: 30px; text-align: center; position: fixed; right: 50px; width: 30px; z-index: 999; background: red; }

Related: See More


Questions / Comments: