This commit is contained in:
parent
0e793ecde5
commit
d9ced4a896
|
@ -46,19 +46,44 @@
|
||||||
i.src = e.src;
|
i.src = e.src;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// <wheeler>
|
||||||
|
const wheelEventListener = function(event) {
|
||||||
|
if (event.target.closest('.media-object')) {
|
||||||
|
if (event.deltaY < 0) {
|
||||||
|
document.getElementById('prev').click();
|
||||||
|
} else if (event.deltaY > 0) {
|
||||||
|
document.getElementById('next').click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('wheel', wheelEventListener);
|
||||||
|
// </wheeler>
|
||||||
|
|
||||||
|
|
||||||
if(f0ckimage = document.querySelector("img#f0ck-image")) {
|
if(f0ckimage = document.querySelector("img#f0ck-image")) {
|
||||||
const f0ckimagescroll = document.querySelector("#image-scroll");
|
const f0ckimagescroll = document.querySelector("#image-scroll");
|
||||||
|
|
||||||
|
let isImageExpanded = false;
|
||||||
|
console.log("entry point - image unclicked")
|
||||||
|
|
||||||
f0ckimage.addEventListener("click", async e => {
|
f0ckimage.addEventListener("click", async e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const img = await imgSize(f0ckimage);
|
const img = await imgSize(f0ckimage);
|
||||||
if(img.width > img.height)
|
console.log("img clicked");
|
||||||
return;
|
if (isImageExpanded) {
|
||||||
f0ckimagescroll.hasAttribute("style")
|
isImageExpanded = false;
|
||||||
? f0ckimagescroll.removeAttribute("style")
|
f0ckimagescroll.removeAttribute("style");
|
||||||
: f0ckimagescroll.setAttribute("style", "overflow-y: scroll");
|
f0ckimage.removeAttribute("style");
|
||||||
f0ckimage.hasAttribute("style")
|
console.log("image is not expanded")
|
||||||
? f0ckimage.removeAttribute("style")
|
window.addEventListener('wheel', wheelEventListener);
|
||||||
: f0ckimage.setAttribute("style", "max-height: none; height: auto; width: 100%; position: absolute; left: 0; border: var(--img-border-width) solid var(--img-border-color); border-top: none; border-bottom: none;");
|
} else {
|
||||||
|
if (img.width > img.height) return;
|
||||||
|
isImageExpanded = true;
|
||||||
|
window.removeEventListener('wheel', wheelEventListener);
|
||||||
|
f0ckimagescroll.setAttribute("style", "overflow-y: scroll");
|
||||||
|
f0ckimage.setAttribute("style", "max-height: none; height: auto; width: 100%; position: absolute; left: 0; border: var(--img-border-width) solid var(--img-border-color); border-top: none; border-bottom: none;");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// </image-responsive>
|
// </image-responsive>
|
||||||
|
@ -236,14 +261,6 @@
|
||||||
// </mediakeys>
|
// </mediakeys>
|
||||||
|
|
||||||
// <scroller>
|
// <scroller>
|
||||||
window.addEventListener('wheel', function(event) {
|
|
||||||
if (event.target.closest('.media-object')) {
|
|
||||||
if (event.deltaY < 0) {
|
|
||||||
document.getElementById('prev').click();
|
|
||||||
} else if (event.deltaY > 0) {
|
|
||||||
document.getElementById('next').click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// </scroller>
|
// </scroller>
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user