diff options
Diffstat (limited to 'rannak/mangud/kaitseliitlane/sundmused')
-rw-r--r-- | rannak/mangud/kaitseliitlane/sundmused/script.js | 73 |
1 files changed, 56 insertions, 17 deletions
diff --git a/rannak/mangud/kaitseliitlane/sundmused/script.js b/rannak/mangud/kaitseliitlane/sundmused/script.js index daa263d..3b92b1d 100644 --- a/rannak/mangud/kaitseliitlane/sundmused/script.js +++ b/rannak/mangud/kaitseliitlane/sundmused/script.js @@ -4,6 +4,10 @@ document.addEventListener('DOMContentLoaded', () => { }); + + +// Draggable Items + const list_items = document.querySelectorAll(".list-item"); const lists = document.querySelectorAll(".list"); @@ -25,33 +29,47 @@ for (let i=0; i < list_items.length; i++){ checkIfAllGood(); }); - for (let j=0; j < lists.length; j++){ - const list = lists[j]; +} + - /* Event Listeners */ +// Dropping Spots - list.addEventListener("dragenter",e => (e.preventDefault())); +for (let j=0; j < lists.length; j++){ + const list = lists[j]; - list.addEventListener("dragover",e => { - e.preventDefault(); - list.style.backgroundColor = "rgba(0,0,0,0.5)"; - }); + /* Event Listeners */ + list.addEventListener("dragenter",e => (e.preventDefault())); - list.addEventListener("dragleave",e => { - list.style.backgroundColor = "rgba(0,0,0,0.3)"; - }); + list.addEventListener("dragover",e => { + e.preventDefault(); + list.style.backgroundColor = "rgba(0,0,0,0.9)"; + list.style.transform = "scale(1.3)"; + }); - list.addEventListener("drop",e => { - if (list.children.length == 0 || list.className.includes("startBasket")) - list.append(draggedItem); - list.style.backgroundColor = "rgba(0,0,0,0.5)"; - }) - } + list.addEventListener("dragleave",e => { + list.style.backgroundColor = "rgba(0,0,0,0.3)"; + list.style.transform = "scale(1)"; + }); + + list.addEventListener("drop",e => { + if (list.children.length == 0 || list.className.includes("startBasket")) + list.append(draggedItem); + list.style.backgroundColor = "rgba(0,0,0,0.3)"; + list.style.transform = "scale(1)"; + + }) } + + + + + + + function checkIfAllGood(){ let rightDone = []; @@ -75,3 +93,24 @@ function checkIfAllGood(){ btn.onclick = () => location.href = ""; } } + + + + +// Smooth scroll stuff + +// const ekraaniPikkus = window.innerHeight; +// +// window.ondragover = function(e){ +// //console.log(e.clientY); +// +// if (e.clientY > (ekraaniPikkus - 300)){ +// window.scrollTo(0, 400); +// } +// +// else if (e.clientY < (300)) +// window.scrollTo(0, -400); +// } + + + |