Team:UC San Diego/mainjs

// scroll function function scrollToID(id, speed){ var offSet = 0; var targetOffset = jQuery(id).offset().top - offSet; var mainNav = jQuery('#main-nav'); jQuery('html,body').animate({scrollTop:targetOffset}, speed); if (mainNav.hasClass("open")) { mainNav.css("height", "1px").removeClass("in").addClass("collapse"); mainNav.removeClass("open"); } }



if (typeof console === "undefined") {

   console = {
       log: function() { }
   };

}


jQuery(document).ready(function() { // navigation click actions jQuery('.scroll-link').on('click', function(event){ event.preventDefault(); var sectionID = jQuery(this).attr('data-id'); scrollToID('#' + sectionID, 750); }); // scroll to top action jQuery('.scroll-top').on('click', function(event) { event.preventDefault(); jQuery('html, body').animate({scrollTop:0}, 'slow'); }); // mobile nav toggle jQuery('#nav-toggle').on('click', function (event) { event.preventDefault(); jQuery('#main-nav').toggleClass("open"); }); });