scroll to top
// to top button
$(function() {
var toTop = $('.to-top');
$(window).scroll(function() {
if( $(window).scrollTop() > 0 ) {
$(toTop).show();
} else {
$(toTop).hide();
}
});
$(toTop).click(function() {
var body = $('html, body');
if ( $(window).scrollTop() < ($(window).height() * 2) ) {
body.animate({ scrollTop: 0 }, 800);
} else {
body.animate({ scrollTop: 0 }, 0);
}
return false;
});
});