Difference between revisions of "Team:UC San Diego/mainjs"

Line 12: Line 12:
  
 
jQuery(function() {
 
jQuery(function() {
   jQuery('a[href*=#]:not([href=#])').click(function() {
+
   jQuery('a[href*=#dreamteam]:not([href=#dreamteam])').click(function() {
 
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
 
     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
 
       var target = jQuery(this.hash);
 
       var target = jQuery(this.hash);

Revision as of 01:15, 19 September 2015

// 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"); //} //}

jQuery(function() {

 jQuery('a[href*=#dreamteam]:not([href=#dreamteam])').click(function() {
   if (location.pathname.replace(/^\//,) == this.pathname.replace(/^\//,) && location.hostname == this.hostname) {
     var target = jQuery(this.hash);
     target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
     if (target.length) {
       jQuery('html,body').animate({
         scrollTop: target.offset().top
       }, 1000);
       return false;
     }
   }
 });

});


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);

               //('#your-div').scrollView();

//}); // 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"); }); });