First try on apple fix horizontal scroll
This commit is contained in:
parent
ad94bb8775
commit
42f34af277
@ -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,11 +32,44 @@ function initialize() {
|
||||
}
|
||||
});
|
||||
|
||||
// remove the indicator on enter
|
||||
exhibit.addEventListener("mouseenter", () => {
|
||||
notice[0].remove();
|
||||
notice[1].remove();
|
||||
}, {once: true});
|
||||
// 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) {
|
||||
|
@ -7,7 +7,6 @@
|
||||
* Version: 1.2
|
||||
*/
|
||||
function zoom(factor, imgName) {
|
||||
console.log("CALL:" + imgName);
|
||||
let winW = Math.max(document.documentElement.clientWidth, window.innerWidth);
|
||||
let img = document.getElementById(imgName);
|
||||
let magni = img.parentElement;
|
||||
|
Loading…
x
Reference in New Issue
Block a user