Files
tabu/public/script.js
T
Glitch (hello-express) d13977cefc ⚡️⭐️ Checkpoint
./views/index.html:1954897/42155
./public/script.js:1954897/5660
2019-06-28 05:33:33 +00:00

40 lines
1.0 KiB
JavaScript

(function() {
'use strict';
var btns = document.querySelectorAll('[data-open]')
let prev = null
for (var i = 0; i < btns.length; i++) {
;btns[i].addEventListener('click', function (e) {
const iam = Array.from(document.body.children).filter(el => !el.hidden)[0];
console.log({iam, prev})
iam.hidden = true;
if (this.dataset.open === 'prev') {
prev.hidden = false;
} else {
document.getElementById(this.dataset.open).hidden = false
}
prev = iam
})
}
const fs = document.getElementById('fs')
fs.addEventListener('click', e => {
if (!screen.orientation.lock) return
document
.documentElement
.requestFullscreen()
.then(function () {
screen.orientation.lock('landscape').catch(function () {
document.exitFullscreen()
})
})
});
}());