2016-09-20 16:22:12 +00:00
|
|
|
// Nav Scripts
|
|
|
|
const $navLinks = $('.main-nav--links');
|
|
|
|
const $navToggle = $('.main-nav--toggle');
|
|
|
|
const navBreakpoint = 730; // this should match $nav-breakpoint in _nav.scss
|
2016-09-26 19:45:24 +00:00
|
|
|
const $mainContent = $('#main-content');
|
2016-09-26 20:05:06 +00:00
|
|
|
const $mainNav = $('#main-nav');
|
2016-09-26 19:45:24 +00:00
|
|
|
|
2016-09-20 16:22:12 +00:00
|
|
|
$navToggle.click(function() {
|
|
|
|
$(this).toggleClass('is-active');
|
|
|
|
$navLinks.slideToggle();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).resize(function() {
|
|
|
|
if ($(window).width() >= navBreakpoint) {
|
|
|
|
$navToggle.removeClass('is-active');
|
|
|
|
$navLinks.attr("style", "");
|
|
|
|
}
|
2016-09-26 19:45:24 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// toggles fixed nav position when the window is too short
|
2016-09-29 21:56:09 +00:00
|
|
|
var footerOffsetTop, navOffsetBottom;
|
2016-09-26 19:45:24 +00:00
|
|
|
|
|
|
|
function toggleFixedNavPosition() {
|
2016-09-26 20:05:06 +00:00
|
|
|
navOffsetBottom = $mainNav.outerHeight() + $(window).scrollTop();
|
2016-09-29 21:56:09 +00:00
|
|
|
footerOffsetTop = $("#main-footer").offset().top;
|
2016-09-26 19:45:24 +00:00
|
|
|
|
2016-09-29 21:56:09 +00:00
|
|
|
$mainNav.toggleClass("is-fixed-bottom", (footerOffsetTop < navOffsetBottom) && $(window).height() <= 759)
|
2016-09-26 19:45:24 +00:00
|
|
|
}
|
|
|
|
|
2016-09-29 21:56:09 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
$mainContent.css('min-height', $mainNav.outerHeight() - $('#main-nav-ctas').outerHeight());
|
|
|
|
toggleFixedNavPosition();
|
|
|
|
});
|
2016-09-26 19:45:24 +00:00
|
|
|
|
|
|
|
$(window).scroll(function() {
|
|
|
|
toggleFixedNavPosition();
|
|
|
|
});
|
2016-09-29 21:56:09 +00:00
|
|
|
|