14 lines
394 B
JavaScript
14 lines
394 B
JavaScript
|
$(window).scroll(function() {
|
||
|
$(window).scrollTop() > $(window).height()*0.5 ? $("#backtotop").addClass("show") : $("#backtotop").removeClass("show");
|
||
|
});
|
||
|
|
||
|
$("#backtotop").click(function() {
|
||
|
$("#backtotop").addClass("launch");
|
||
|
$("html, body").animate({
|
||
|
scrollTop: 0
|
||
|
}, 1000, function() {
|
||
|
$("#backtotop").removeClass("show launch");
|
||
|
});
|
||
|
return false;
|
||
|
});
|