web/assets/js/_commons/back-to-top.js

18 lines
410 B
JavaScript
Raw Normal View History

2019-09-30 15:38:41 +03:00
/*
Reference: https://bootsnipp.com/snippets/featured/link-to-top-page
*/
$(window).scroll(function() {
if ($(this).scrollTop() > 50
2020-08-19 07:26:45 +03:00
&& $("#sidebar-trigger").css("display") === "none") {
$("#back-to-top").fadeIn();
2019-09-30 15:38:41 +03:00
} else {
2020-08-19 07:26:45 +03:00
$("#back-to-top").fadeOut();
2019-09-30 15:38:41 +03:00
}
});
$(function() {
2020-08-19 07:26:45 +03:00
$("#back-to-top").click(function() {
$("body,html").animate({scrollTop: 0}, 800);
2019-09-30 15:38:41 +03:00
return false;
});
});