Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Roshu2003 authored Sep 27, 2023
1 parent 235d3d2 commit b393e50
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,19 @@ jQuery(document).ready(function($) {
});
/* Chatboat Code */
})

// -------arrow scroll-----------
// ===== Scroll to Top ====
$(window).scroll(function() {
if ($(this).scrollTop() >= 50) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(200); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(200); // Else fade out the arrow
}
});
$('#return-to-top').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});

0 comments on commit b393e50

Please sign in to comment.