Last active
November 14, 2016 20:30
-
-
Save tinothepro/4e01361ce70aa17fdc5dede54c609159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Utilized for mobile navigation and sticky nav when scrolling | |
jQuery(function ($) { | |
if (document.documentElement.clientWidth >= 768) { | |
if (window.location.pathname != '/work/') { | |
var height = $(window).height(); | |
var siteHeader = document.getElementsByClassName('site-header')[0]; | |
siteHeader.style.height = height + 'px'; | |
} | |
if (window.location.pathname != '/work/') { | |
$(window).resize(function () { | |
var height = $(window).height(); | |
var siteHeader = document.getElementsByClassName('site-header')[0]; | |
siteHeader.style.height = height + 'px'; | |
}); | |
} | |
} | |
$('#menu-main-menu li:first-child').before('<div class="blocker"><a href="/"></a></div>'); | |
$('#menu-main-menu').wrap('<div class="menu-container"></div>'); | |
$('header .genesis-nav-menu').before('<div id="responsive-menu-icon" class="closed"></div>'); | |
$('header .genesis-nav-menu').addClass('responsive-menu'); | |
$('#responsive-menu-icon').click(function () { | |
$('header .genesis-nav-menu').slideToggle(); | |
$(this).toggleClass('open'); | |
}); | |
$(window).resize(function () { | |
if (window.innerWidth > 600) { | |
$('header .genesis-nav-menu').removeAttr('style'); | |
} | |
}); | |
$(window).scroll(function () { | |
var yPos = ($(window).scrollTop()); | |
if (document.documentElement.clientWidth > 768) { | |
if (yPos > 0) { | |
$('.menu-container').addClass('anchor'); | |
$('#menu-main-menu').addClass('wrap add-logo'); | |
} else { | |
$('.menu-container').removeClass('anchor'); | |
$('#menu-main-menu').removeClass('wrap add-logo'); | |
} | |
} | |
}); | |
if (document.documentElement.clientWidth < 769) { | |
$('.menu-container').addClass('anchor'); | |
$('#menu-main-menu').addClass('wrap'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment