mirror of
https://github.com/pmoreno-rodriguez/grav-theme-future2021.git
synced 2025-06-07 20:08:54 +00:00
Back to top function integrated in main.js
This commit is contained in:
parent
79b0019c11
commit
2dd121fde0
1 changed files with 17 additions and 0 deletions
|
@ -91,5 +91,22 @@
|
||||||
breakpoints.on('>large', function() {
|
breakpoints.on('>large', function() {
|
||||||
$intro.prependTo($sidebar);
|
$intro.prependTo($sidebar);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Backt to top
|
||||||
|
|
||||||
|
var btn = $('#back-to-top');
|
||||||
|
|
||||||
|
$(window).scroll(function() {
|
||||||
|
if ($(window).scrollTop() > 300) {
|
||||||
|
btn.addClass('show');
|
||||||
|
} else {
|
||||||
|
btn.removeClass('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btn.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('html, body').animate({scrollTop:0}, '300');
|
||||||
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
Loading…
Add table
Reference in a new issue