📜  如何在html代码示例中添加返回顶部按钮

📅  最后修改于: 2022-03-11 14:53:24.597000             🧑  作者: 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));