|
|
|
@ -16,6 +16,7 @@ function initialize() {
|
|
|
|
|
let welcome = document.getElementById("welcome");
|
|
|
|
|
let exhibit = document.getElementById("exhibition");
|
|
|
|
|
let notice = Array.from(document.getElementsByClassName("arrow"));
|
|
|
|
|
let userAgent = window.navigator.userAgent;
|
|
|
|
|
flyingText(welcome);
|
|
|
|
|
document.addEventListener("click", (e) => {
|
|
|
|
|
let overlay = document.getElementById("info-box");
|
|
|
|
@ -31,12 +32,45 @@ function initialize() {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// remove the indicator on enter
|
|
|
|
|
// Handle dummy dum dum Apple products >:
|
|
|
|
|
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
|
|
|
|
|
exhibit.addEventListener("scroll", (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
let startpos;
|
|
|
|
|
exhibit.addEventListener("touchmove", (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exhibit.addEventListener("touchstart", (e) => {
|
|
|
|
|
startpos = e.touches[0].clientX;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
exhibit.addEventListener("touchend", (e) => {
|
|
|
|
|
let slide = startpos - e.changedTouches[0].clientX;
|
|
|
|
|
if (slide < -5 || slide > 5 ) {
|
|
|
|
|
doSlide(exhibit, slide);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
remove the indicator on enter
|
|
|
|
|
exhibit.addEventListener("mouseenter", () => {
|
|
|
|
|
notice[0].remove();
|
|
|
|
|
notice[1].remove();
|
|
|
|
|
}, {once: true});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function doSlide(elem, dist) {
|
|
|
|
|
console.log(dist);
|
|
|
|
|
let hM = elem.scrollHeight;
|
|
|
|
|
let sT = elem.scrollTop;
|
|
|
|
|
if (dist < 0)
|
|
|
|
|
elem.scrollTop = (sT + dist > 0) ? sT + dist : 0;
|
|
|
|
|
else
|
|
|
|
|
elem.scrollTop = (sT + dist > hM) ? hM : sT + dist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleThumb(overlay, elem) {
|
|
|
|
|
let imgName = elem.dataset.img;
|
|
|
|
|