📜  返回顶部按钮 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:17.950000             🧑  作者: Mango

代码示例2
// BACK TO TOP BUTTON WITH JQUERY //
const win = $(window);
const b2t = $('.back-top');
const html_body = $('html, body');
//back to top fadetoogle//
win.scroll(() => win.scrollTop() > 100 ? b2t.fadeIn() : b2t.fadeOut());
//back to top effect//
b2t.click(() => html_body.animate({scrollTop: 0}, 2500));