This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
lnapp/media/theme/baseadmin/js/backtotop.js

26 lines
486 B
JavaScript
Raw Permalink Normal View History

$(document).ready(function() {
var backToTop = $('<a>', { id: 'back-to-top', href: '#top' });
2014-09-08 13:42:05 +00:00
var icon = $('<i>', { class: 'fa fa-chevron-up' });
backToTop.appendTo ('body');
icon.appendTo (backToTop);
backToTop.hide();
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
backToTop.fadeIn ();
} else {
backToTop.fadeOut ();
}
});
backToTop.click (function (e) {
e.preventDefault ();
$('body, html').animate({
scrollTop: 0
}, 600);
});
});