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
485 B
JavaScript
Raw Normal View History

$(document).ready(function() {
var backToTop = $('<a>', { id: 'back-to-top', href: '#top' });
var icon = $('<i>', { class: 'icon-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);
});
});