|
|
@ -4,8 +4,8 @@ const stickerContainer = document.getElementById("sticker-container");
|
|
|
|
infoList = Array.from(informations.children);
|
|
|
|
infoList = Array.from(informations.children);
|
|
|
|
loopIndex = 0;
|
|
|
|
loopIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
let windowWidth;
|
|
|
|
let windowWidth = stickerContainer.clientWidth;
|
|
|
|
let windowHeight;
|
|
|
|
let windowHeight = stickerContainer.clientHeight;
|
|
|
|
|
|
|
|
|
|
|
|
let palette = ["#9EDAE2", "#9FD3A8", "#F7D8E8", "#F9F5B0", "#FFC496"];
|
|
|
|
let palette = ["#9EDAE2", "#9FD3A8", "#F7D8E8", "#F9F5B0", "#FFC496"];
|
|
|
|
|
|
|
|
|
|
|
@ -31,15 +31,15 @@ function percentagePosition(e, target) {
|
|
|
|
return { x: ((x / windowWidth) * 100).toFixed(2), y: ((y / windowHeight) * 100).toFixed(2) };
|
|
|
|
return { x: ((x / windowWidth) * 100).toFixed(2), y: ((y / windowHeight) * 100).toFixed(2) };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener("click", (e) => {
|
|
|
|
stickerContainer.addEventListener("click", (e) => {
|
|
|
|
getInput(e);
|
|
|
|
getInput(e);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// Test for trick Safari mobile
|
|
|
|
// Test for trick Safari mobile
|
|
|
|
window.addEventListener("touchstart", () => {});
|
|
|
|
stickerContainer.addEventListener("touchstart", () => {});
|
|
|
|
window.addEventListener("touchend", () => {});
|
|
|
|
stickerContainer.addEventListener("touchend", () => {});
|
|
|
|
window.addEventListener("touchcancel", () => {});
|
|
|
|
stickerContainer.addEventListener("touchcancel", () => {});
|
|
|
|
window.addEventListener("touchmove", () => {});
|
|
|
|
stickerContainer.addEventListener("touchmove", () => {});
|
|
|
|
|
|
|
|
|
|
|
|
function getInput(e) {
|
|
|
|
function getInput(e) {
|
|
|
|
placeSticker(percentagePosition(e, stickerContainer), infoList[loopIndex]);
|
|
|
|
placeSticker(percentagePosition(e, stickerContainer), infoList[loopIndex]);
|
|
|
|