Lidarr/UI/jQuery/ToTheTop.js

26 lines
630 B
JavaScript
Raw Normal View History

2013-06-25 05:47:56 +00:00
'use strict';
define(
[
'bootstrap'
], function () {
$(document).ready(function () {
2013-06-25 06:27:09 +00:00
var _window = $(window);
var _scrollButton = $('#scroll-up');
2013-06-25 05:47:56 +00:00
$(window).scroll(function () {
2013-06-25 06:27:09 +00:00
if (_window.scrollTop() > 100) {
_scrollButton.fadeIn();
2013-06-25 05:47:56 +00:00
}
else {
2013-06-25 06:27:09 +00:00
_scrollButton.fadeOut();
2013-06-25 05:47:56 +00:00
}
});
2013-06-25 06:27:09 +00:00
_scrollButton.click(function () {
2013-06-25 05:47:56 +00:00
$("html, body").animate({ scrollTop: 0 }, 600);
return false;
});
});
});