// JavaScript Document $(function(){ $(window).on('scroll', function(){ var st = $(document).scrollTop(); if(st > 0){ $('#go-top').fadeIn(function(){ $(this).removeClass('dn'); }); }else{ $('#go-top').fadeOut(function(){ $(this).addClass('dn'); }); } }); $('#go-top .top').on('click', function(){ $('html,body').animate({'scrollTop': 0}, 500); }); });