Why won't make my code work.
This code is supposed to detect when two elements are in contact (I will include the relevant html , css, and js): <div id="playArea"> <hr id="ground"> <h1 id="character"></h1> <h3 id="enemy"></h3> css: #playArea { width: 1250px; height: 400px; background-color: black; border-radius: 50px; } #ground { background-color: black; position: relative; top: 265px; } #character { width: 40px; height: 40px; background-color: white; position: relative; top: 200px; } .jumping { animation-name: jumping; animation-duration: 1s; animation-timing-function: linear; animation-iteration-count: infinite; } @keyframes jumping { 0% { transform: translateY(0px); } 14.2% { transform: translateY(-20px); } 28.4% {transform: translateY(-55px); } 42.6% { transform: translateY(-70px); } 64.8% { transform: translateY(-55px); } 79% { transform: translateY(-20px); } 100% { transform: translateY(0px); } } #enemy { width: 20px; height: 20px; background-color: red; position: relative; left: 625px; top: 160px; animation-name: incoming; animation-duration: 3s; animation-iteration-count: infinite; animation-timing-function: linear; } @keyframes incoming { 0% { transform: translateX(0px); } 100% { transform: translateX(-1250px); } } js: var character = document.getElementById("character"); var playArea = document.getElementById("playArea"); var enemy = document.getElementById("enemy"); var hasJumped = false function jumper() { playArea.addEventListener("click", function() { character.classList.add("jumping"); function remove() { character.classList.remove("jumping") } setTimeout(remove, 1005) } ); } var characterStatus = setInterval(function() { var characterCollison = parseInt(window.getComputedStyle(character).getPropertyValue("top")) var enemyCollison = parseInt(window.getComputedStyle(enemy).getPropertyValue("left")) if (enemyCollison === 0 && characterCollison >= 180 ) { alert("HELLO") } }, 1);