Created
January 19, 2020 17:10
-
-
Save levenokk/6028242bbff0776d9f5c7674224c6587 to your computer and use it in GitHub Desktop.
script for arrow up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(window).on('scroll', function () { | |
if ($(this).scrollTop() > $(this).height()) { | |
$('.up-arrow').addClass('active'); | |
} else { | |
$('.up-arrow').removeClass('active'); | |
} | |
}) | |
$('.up-arrow').on('click', function () { | |
$('html, body').animate({ | |
scrollTop: 0 | |
}, 500); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment