Include a back-to-top Button on scrolling down (#446)

* Update index.html

* Create scrollToTop.js

* Update demo.css

* Update index.html
This commit is contained in:
Sparks
2018-10-28 05:34:21 +07:00
committed by Jeffrey Warren
parent 85c92626e4
commit f9376808fd
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
$(document).ready(function($){
$(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 100){
$('.move-up').fadeIn();
} else {
$('.move-up').fadeOut();
}
});
$('.move-up button').click(function(){
$('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
});