1
0
mirror of https://github.com/thangisme/notes.git synced 2024-10-31 16:47:33 -04:00

Show / hide search with mobile nav

This commit is contained in:
Patrick Marsceill 2018-10-23 11:41:25 -04:00
parent 2d1305045e
commit d3e231648f
No known key found for this signature in database
GPG Key ID: 286B93882D828F40

View File

@ -13,6 +13,7 @@ function toggleNav(){
const nav = document.querySelector('.js-main-nav'); const nav = document.querySelector('.js-main-nav');
const auxNav = document.querySelector('.js-aux-nav'); const auxNav = document.querySelector('.js-aux-nav');
const navTrigger = document.querySelector('.js-main-nav-trigger'); const navTrigger = document.querySelector('.js-main-nav-trigger');
const search = document.querySelector('.js-search');
addEvent(navTrigger, 'click', function(){ addEvent(navTrigger, 'click', function(){
var text = navTrigger.innerText; var text = navTrigger.innerText;
@ -21,6 +22,7 @@ function toggleNav(){
nav.classList.toggle('nav-open'); nav.classList.toggle('nav-open');
auxNav.classList.toggle('nav-open'); auxNav.classList.toggle('nav-open');
navTrigger.classList.toggle('nav-open'); navTrigger.classList.toggle('nav-open');
search.classList.toggle('nav-open');
navTrigger.innerText = textToggle; navTrigger.innerText = textToggle;
navTrigger.setAttribute('data-text-toggle', text); navTrigger.setAttribute('data-text-toggle', text);
textToggle = text; textToggle = text;