Difference between revisions of "Team:UC San Diego/mainjs"
Line 15: | Line 15: | ||
jQuery('html, body').animate({ | jQuery('html, body').animate({ | ||
scrollTop: $(this).offset().top | scrollTop: $(this).offset().top | ||
− | }, | + | }, 500); |
}); | }); | ||
} | } |
Revision as of 01:03, 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.fn.scrollView = function () {
return this.each(function () { jQuery('html, body').animate({ scrollTop: $(this).offset().top }, 500); });
}
if (typeof console === "undefined") {
console = { log: function() { } };
}
jQuery('#dreamteam').scrollView(); 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"); }); });