Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Added back to top button
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjacobsio committed Apr 21, 2019
1 parent 9c1a573 commit 41ba56b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
22 changes: 22 additions & 0 deletions back-to-top.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$(document).ready(function() {
$(window).scroll(function() {
if ($(this).scrollTop() > 50) {
$("#back-to-top").fadeIn();
} else {
$("#back-to-top").fadeOut();
}
});
// scroll body to 0px on click
$("#back-to-top").click(function() {
$("#back-to-top").tooltip("hide");
$("body,html").animate(
{
scrollTop: 0
},
800
);
return false;
});

$("#back-to-top").tooltip("show");
});
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
<!-- CSS -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">

<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="bootstrap-overrides.css">
<!-- JavaScript -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<script src="back-to-top.js"></script>
<!-- Fonts -->
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
Expand Down Expand Up @@ -208,8 +209,9 @@ <h5>Contact</h5>
</div>
</hr>
</div>
</div>
</section>
</div>
<button id="back-to-top" href="#" class="btn btn-primary btn-lg back-to-top" role="button" title="Click to return on the top page" data-toggle="tooltip" data-placement="left"><span class="glyphicon glyphicon-chevron-up"></span></button>
</section>
</body>

</html>
7 changes: 7 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ section .section-title {
#footer ul.quick-links li:hover a i {
font-weight: 700;
}
.back-to-top {
cursor: pointer;
position: fixed;
bottom: 20px;
right: 20px;
display: none;
}

@media (max-width: 767px) {
#footer h5 {
Expand Down

0 comments on commit 41ba56b

Please sign in to comment.