diff options
author | Rasmus Luha <rasmus.luha@gmail.com> | 2022-11-05 23:13:57 +0200 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@gmail.com> | 2022-11-05 23:13:57 +0200 |
commit | 1c973624785b77e97791be8c917c4c13b7418be0 (patch) | |
tree | d591c0bc571c03de69a128fd895cab22326c8a08 /rannak/kaart/js | |
parent | f2318deacde703df99fce50800b58f7e6e759e8b (diff) |
actual restructure, previuos commit premature
Diffstat (limited to 'rannak/kaart/js')
-rw-r--r-- | rannak/kaart/js/kaart.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/rannak/kaart/js/kaart.js b/rannak/kaart/js/kaart.js new file mode 100644 index 0000000..4bb0afe --- /dev/null +++ b/rannak/kaart/js/kaart.js @@ -0,0 +1,30 @@ +const riigid = document.querySelectorAll("svg path") + +// Praegu Eesti, Portugal, Holland +const leitavad = ["EE", "PT", "NL"] +let leitud = []; + +// Add click listener +for (let i = 0; i < riigid.length; i++){ + if (leitavad.includes(riigid[i].id)){ + riigid[i].addEventListener("click", e => { + e.target.style.fill = "#00FF00"; + if (!leitud.includes(e.target.id)) + leitud.push(riigid[i].id); + + if (leitavad.length == leitud.length) + moveOnEnable(); + }) + } + else{ + riigid[i].addEventListener("click", e => { + e.target.style.fill = "#FF0000"; + }) + } +} + +function moveOnEnable(){ + const btn = document.querySelector(".moveOn"); + btn.disabled = false; + btn.onclick = () => location.href = "../rolliValik"; +} |