*/
'use strict'
window.onload = () => {
+ const header = document.body.getElementsByTagName('header').item(0)
const nav = document.body.getElementsByTagName('nav').item(0)
+ const main = document.body.getElementsByTagName('main').item(0)
const navAnchors = Array.from(nav.getElementsByTagName('div').item(0).getElementsByTagName('a'))
const pageDisplay = nav.getElementsByTagName('footer').item(0)
const currentPageName = `${pageDisplay.innerHTML}`
a.addEventListener('mouseout', () => pageDisplay.innerHTML = currentPageName)
})
updateNav()
+
+ let oldScrollY = window.scrollY
+ const _downDelay = 15
+ let downDelay = 0
+ const _upDelay = 5
+ let upDelay = _upDelay
+ const navUp = () => nav.style.top = Math.min(parseInt(nav.style.top,10) + (oldScrollY - window.scrollY), 0) + 'px'
+ const navDown = () => nav.style.top = Math.max(parseInt(nav.style.top,10) - (window.scrollY - oldScrollY), -nav.offsetHeight) + 'px'
+ nav.style.top = 0 + 'px'
+ window.onscroll = () => {
+ if (window.matchMedia("(orientation: portrait)").matches) {
+ if (window.scrollY < oldScrollY) /* up */ {
+ if (upDelay-- <= 0)
+ downDelay = _downDelay
+ navUp()
+ }
+ else {
+ upDelay = _upDelay
+ if(downDelay-- <= 0)
+ navDown()
+ else
+ navUp()
+ }
+ oldScrollY = window.scrollY
+ }
+ }
}
+
const resizeIFrame = (iframe) => {
iframe.style.height = 0
iframe.style.height = (iframe.contentWindow.document.body.scrollHeight * 1.2) + 'px';