- /*
- * Menu actions
- */
- function mobile_menu(action) {
- if (action == 'close') {
- if ($('#page-header').hasClass('sticky')) {
- $('nav.main-mn').fadeOut(400, function() {
- $('#main-menu .mobile-logo').fadeIn(200);
- });
- } else {
- $('nav.main-mn').fadeOut(400);
- }
- $('#mobile-menu').addClass('closed').removeClass('opened');
- } else if (action == 'open') {
- $('nav.main-mn').fadeIn(200, function () { });
- if ($('#page-header').hasClass('sticky')) {
- $('#main-menu .mobile-logo').hide();
- }
- $('#mobile-menu').addClass('opened').removeClass('closed');
- }
- }
- /*
- * Anchor jump animation
- */
- function jumpToAnchor(target, offset, speed) {
- offset = (typeof offset !== 'undefined') ? offset : 0;
- speed = (typeof speed !== 'undefined') ? speed : 1200;
- jQuery('html, body').stop().animate({
- scrollTop: jQuery(target).offset().top - offset
- }, speed, 'easeInOutExpo');
- console.log(target);
- }
- /*
- * Menu click animation
- */
- $('a.anchor').click(function (event) {
- let hash = $(this)[0].hash;
- jumpToAnchor(hash, 100);
- mobile_menu('close');
- event.preventDefault();
- });
- $('li.anchor-link a').click(function (event) {
- let hash = $(this)[0].hash;
- jumpToAnchor(hash, 100);
- mobile_menu('close');
- event.preventDefault();
- });
Recent Pastes