Created
October 30, 2017 08:08
-
-
Save fiximportant/8d477723f9630a520f966ffcce7cc56e to your computer and use it in GitHub Desktop.
ScrollUP
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
<script> | |
$(window).scroll(function () { | |
if ($(this).scrollTop() > 300) $('.js-scrollup>a').fadeIn(200); | |
else $('.js-scrollup>a').fadeOut(400); | |
}); | |
$('.js-scrollup>a').click(function () { | |
$('html,body').animate({ | |
scrollTop: 0 | |
}, 800); | |
return false; | |
}); | |
</script> | |
<div class="b-scrollup js-scrollup"><a href="#moveup"><img src="/files/110/i-scrollup.png" alt=""></a></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment