返回顶部
jQuery(document).ready(function($){ var offset = 300, offset_opacity = 1200, scroll_top_duration = 700, $back_to_top = $('#backtop'); $(window).scroll(function(){ ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('bt_visible') : $back_to_top.removeClass('bt_visible'); }); $back_to_top.on('click', function(event){ event.preventDefault(); $('body,html').animate({ scrollTop: 0 , }, scroll_top_duration ); }); });