Created
April 13, 2020 11:06
-
-
Save akashsky44/dd131bac66d154586b86061290066511 to your computer and use it in GitHub Desktop.
Page Scroll To Top
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
/* page scroll top on click function */ | |
jQuery("button.back-to-top").on('click',function() { | |
jQuery('html').animate({ scrollTop: 0 }, 500); | |
return false; | |
}) | |
jQuery(window).on("scroll", function() { | |
var scrollWindowHeight = jQuery(window).scrollTop(); | |
if (scrollWindowHeight > 900) { | |
jQuery("button.back-to-top").slideDown(1000).fadeIn(1000); | |
} else { | |
jQuery("button.back-to-top").slideUp(1000).fadeOut(1000); | |
} | |
}); | |
/* page scroll top on click function end*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment