2016-09-20 16:22:12 +00:00
|
|
|
// Nav Scripts
|
2017-01-18 04:59:40 +00:00
|
|
|
const $navLinks = $('.main-nav--links');
|
2017-01-09 22:11:49 +00:00
|
|
|
const $navToggle = $('.main-nav--toggle');
|
2017-01-18 04:59:40 +00:00
|
|
|
const navBreakpoint = 730; // this should match $nav-breakpoint in _nav.scss
|
|
|
|
const $mainContent = $('#main-content');
|
|
|
|
const $mainNav = $('#main-nav');
|
|
|
|
const $mainNavCtas = $('#main-nav-ctas');
|
2017-01-09 22:11:49 +00:00
|
|
|
const currentPagePath = location.pathname;
|
2017-01-18 04:59:40 +00:00
|
|
|
const navPageLinks = ['about', 'docs', 'tutorials', 'community'];
|
2016-09-26 19:45:24 +00:00
|
|
|
|
2016-09-20 16:22:12 +00:00
|
|
|
$navToggle.click(function() {
|
2017-01-18 04:59:40 +00:00
|
|
|
$(this).toggleClass('turn');
|
|
|
|
$navLinks.slideToggle(100);
|
2016-09-20 16:22:12 +00:00
|
|
|
});
|
|
|
|
|
2017-01-18 04:59:40 +00:00
|
|
|
$(window).resize(function() {
|
|
|
|
if ($(window).width() >= navBreakpoint) {
|
|
|
|
$navToggle.removeClass('is-active');
|
|
|
|
$navLinks.attr("style", "");
|
2016-09-20 16:22:12 +00:00
|
|
|
}
|
2017-01-18 04:59:40 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
//Sub Mobile Nav for docs
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
//Hide links for docs
|
|
|
|
$('li.main-nav--link.docs--inside--link').hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$('span.toggle').click(function() {
|
|
|
|
$(this).toggleClass('turn');
|
|
|
|
//hide links that are not docs
|
|
|
|
$('.docs').toggleClass('t-blue');
|
|
|
|
$('.hide-docs').toggleClass('hide');
|
|
|
|
$('li.main-nav--link.docs--inside--link').slideToggle(100);
|
|
|
|
});
|
|
|
|
|
|
|
|
// toggles fixed nav position when the window is too short
|
|
|
|
var footerOffsetTop, navOffsetBottom;
|
|
|
|
|
|
|
|
function toggleFixedNavPosition() {
|
|
|
|
navOffsetBottom = $mainNav.outerHeight() + $(window).scrollTop();
|
|
|
|
footerOffsetTop = $("#main-footer").offset().top;
|
|
|
|
|
|
|
|
$mainNav.toggleClass("is-fixed-bottom", (footerOffsetTop < navOffsetBottom) && $(window).height() <= 759)
|
|
|
|
}
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$mainContent.css('min-height', $mainNav.outerHeight() - $('#main-nav-ctas').outerHeight());
|
|
|
|
toggleFixedNavPosition();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).scroll(function() {
|
|
|
|
toggleFixedNavPosition();
|
|
|
|
});
|
|
|
|
|
|
|
|
///Logic to add color to actie page link --Not working WIP - Hannah
|
|
|
|
//for (var linkName in navPageLinks) {
|
|
|
|
// var linkNamePath = navPageLinks[linkName],
|
|
|
|
// currentPagePath = currentPagePath.split('/')[1];
|
|
|
|
// if (currentPagePath == linkNamePath) {
|
|
|
|
// $('#main-nav-ctas a' + navPageLinks[linkName]).addClass('t-purple');
|
|
|
|
// }
|
|
|
|
//};
|
2016-09-29 21:56:09 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
|
|
|
|
|
2016-09-30 16:37:43 +00:00
|
|
|
// handle nav when global message exists
|
|
|
|
// gm_session_id is set on at template level
|
2017-01-09 05:29:00 +00:00
|
|
|
//var globalMessageHeight;
|
|
|
|
//const $globalMessage = $("#global-message");
|
2016-09-30 16:37:43 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
//function adjustNavPosition() {
|
|
|
|
// globalMessageHeight = $globalMessage.outerHeight();
|
2016-09-30 16:37:43 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
// if ($globalMessage.is(":visible")) {
|
|
|
|
// $mainNav.css('top', globalMessageHeight);
|
|
|
|
// $mainNavCtas.css('top', globalMessageHeight);
|
|
|
|
// $mainContent.css('margin-top', globalMessageHeight + 100);
|
|
|
|
// }
|
|
|
|
//}
|
2016-09-30 16:37:43 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
//if(!localStorage.getItem(gm_session_id)) {
|
|
|
|
// $globalMessage.addClass('is-visible');
|
|
|
|
// adjustNavPosition();
|
|
|
|
//}
|
2016-09-30 16:37:43 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
//$(document).ready(function() {
|
|
|
|
// $("#global-message .dismiss-button").click(function(e) {
|
|
|
|
// $globalMessage.removeClass('is-visible')
|
|
|
|
// $mainNav.css('top', '');
|
|
|
|
// $mainNavCtas.css('top', '');
|
|
|
|
// $mainContent.css('margin-top', 100);
|
|
|
|
// localStorage.setItem(gm_session_id, "true");
|
|
|
|
// return false;
|
|
|
|
// });
|
|
|
|
//});
|
2016-09-30 16:37:43 +00:00
|
|
|
|
2017-01-09 05:29:00 +00:00
|
|
|
//$(window).resize(function() {
|
|
|
|
// if(!localStorage.getItem(gm_session_id)) {
|
|
|
|
// adjustNavPosition();
|
|
|
|
// }
|
|
|
|
//});
|