1
+ (function(){var $=document.querySelector.bind(document),$$=document.querySelectorAll.bind(document),menuActive=false
2
+ window.onscroll=function(){var scrollPosition=window.pageYOffset||document.documentElement.scrollTop,windowHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,navHeight=$('nav').clientHeight
3
+ if(scrollPosition>windowHeight-navHeight){$('nav').classList.add('nav-fixed')
4
+ $$('nav > .logo, nav > .nav-toggle').forEach(function(el){el.style.visibility='visible'
5
+ el.classList.add('show')
6
+ el.classList.remove('hide')})}else{$('nav').classList.remove('nav-fixed')
7
+ $$('nav > .logo, nav > .nav-toggle').forEach(function(el){el.style.visibility='hidden'
8
+ el.classList.add('hide')
9
+ el.classList.remove('show')})}}
10
+ $('.nav-icon').addEventListener('click',function(){$$('.nav-full, main').forEach(function(el){el.classList.toggle('active')})
11
+ if(menuActive){this.querySelector('img:nth-of-type(1)').style.display='inline-block'
12
+ this.querySelector('img:nth-of-type(2)').style.display='none'
13
+ menuActive=false}else{this.querySelector('img:nth-of-type(1)').style.display='none'
14
+ this.querySelector('img:nth-of-type(2)').style.display='inline-block'
15
+ menuActive=true}})
16
+ $$('.nav-full a').forEach(function(links){links.addEventListener('click',function(){$$('.nav-full, main').forEach(function(el){el.classList.toggle('active')})})})
17
+ $('.logo').addEventListener('click',function(){if($('.nav-full').classList.contains('active')){$$('.nav-full, main').forEach(function(el){el.classList.toggle('active')})}})
18
+ $('body').addEventListener('click',function(){if($('.nav-full').classList.contains('active')){$('html').style.overflowY='hidden'}else{$('html').style.overflowY='scroll'}})
19
+ function fullMobileViewport(){var element=this,viewportHeight=window.innerHeight,heightChangeTolerance=100
20
+ $(window).resize(function(){if(Math.abs(viewportHeight-window.innerHeight)>heightChangeTolerance){viewportHeight=window.innerHeight
21
+ update()}})
22
+ function update(){element.style.height=(viewportHeight+'px')}
23
+ update()}
24
+ $$('header').forEach(function(){fullMobileViewport})})()
0 commit comments