From 9635284f60818a7819f006e87271b51b4e4895bf Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Wed, 16 May 2018 12:34:20 +0200 Subject: [PATCH] Close the nav sheet after click (needed for anchor links). --- static/js/contact.js | 2 +- static/js/script.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/static/js/contact.js b/static/js/contact.js index 6b63c71..60dcc5e 100644 --- a/static/js/contact.js +++ b/static/js/contact.js @@ -35,7 +35,7 @@ }); // Mark the form as submitted. - $contact_button.on('click touchstart MSPointerDown', function () { + $contact_button.click(function () { $contact_form.addClass('js-submitted'); }); diff --git a/static/js/script.js b/static/js/script.js index 345d0aa..d9a4dc3 100644 --- a/static/js/script.js +++ b/static/js/script.js @@ -22,11 +22,15 @@ $('.main-menu').addClass('hidden').clone().removeClass('main-menu layout__navigation hidden').addClass('js-main-menu').appendTo('.mobile-nav-sheet').find('.navbar').removeClass('navbar').addClass('js-navbar'); // Toggle the mobile nav sheet. - $('.mobile-nav-cover, .mobile-nav-toggle').on('click toushstart', function (e) { + $('.mobile-nav-cover, .mobile-nav-toggle').click(function (e) { e.preventDefault(); $('body').scrollTop(0).toggleClass('js-nav-open'); }); + // Close the nav sheet after click (needed for anchor links). + $('.mobile-nav-sheet').find('a').click(function () { + $('body').removeClass('js-nav-open'); + }); } }