Team:NKU CHINA/Javacsript/top

   	/*backTotop的显示设置*/

jQuery(document).ready(function($){ var offset = 300, offset_opacity = 1200, scroll_top_duration = 700, $back_to_top = $('.cd-top'); /*backTotop的显示设置*/

/*隐藏backTotop按钮*/ $(window).scroll(function(){ ( $(this).scrollTop() > offset ) ? $back_to_top.addClass('cd-is-visible') : $back_to_top.removeClass('cd-is-visible cd-fade-out'); if( $(this).scrollTop() > offset_opacity ) { $back_to_top.addClass('cd-fade-out'); } }); /*隐藏backTotop按钮*/

/*backTotop的实现*/ $back_to_top.on('click', function(event){ event.preventDefault(); $('body,html').animate({ scrollTop: 0 , }, scroll_top_duration ); });

}); /*backTotop的实现*/