You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
584 B
24 lines
584 B
var $ = require('jquery');
|
|
var _ = require('underscore');
|
|
|
|
$(document).ready(function() {
|
|
var _window = $(window);
|
|
var _scrollContainer = $('#scroll-up');
|
|
var _scrollButton = $('#scroll-up i');
|
|
|
|
var _scrollHandler = function() {
|
|
if (_window.scrollTop() > 400) {
|
|
_scrollContainer.fadeIn();
|
|
} else {
|
|
_scrollContainer.fadeOut();
|
|
}
|
|
};
|
|
|
|
$(window).scroll(_.throttle(_scrollHandler, 500));
|
|
_scrollButton.click(function() {
|
|
$('html, body').animate({ scrollTop : 0 }, 600);
|
|
return false;
|
|
});
|
|
});
|
|
|