// ===== Scroll to Top ==== $(window).scroll(function() { if ($(this).scrollTop() >= 0) { // If page is scrolled more than 50px $('#gotel').fadeIn("25000"); // Fade in the arrow } else { $('#gotel').fadeOut("25000"); // Else fade out the arrow } }); function scrollNav() { $('#gotel a').click(function(){ //Toggle Class $(".active").removeClass("active"); $(this).closest('li').addClass("active"); var theClass = $(this).attr("class"); $('.'+theClass).parent('li').addClass('active'); //Animate $('html, body').stop().animate({ scrollTop: $( $(this).attr('href') ).offset().top - 30 }, 400); return false; }); $('.scrollTop a').scrollTop(); } scrollNav();