0

Problem With Javaacript

Why cant i conect my Images to javascript file here on Sololearn.I created project but getting null error even my ids are correct?Is it something with the app that it cant do some things or...

21st Aug 2023, 5:11 PM
Samir Krasnic
Samir Krasnic - avatar
4 Antworten
0
you can only access DOM elements once they are loaded. wrap all your js inside of window.onload = () => { // your code goes here } If you need help with your code, LINK YOUR CODE.
21st Aug 2023, 5:56 PM
Lisa
Lisa - avatar
0
window.onload = () => { const sun = document.getElementById('sun'); const moon =document.getElementById("moon"); moon.addEventListener('mousemove', (event) => { const moonX = event.clientX; const sunX = sun.getBoundingClientRect().left; if (moonX > sunX && moonX < sunX + sun.offsetWidth) { // Moon touches the sun sun.style.boxShadow = '0 0 5px 5px yellow'; } else { // Moon is not touching the sun sun.style.boxShadow = 'none'; } }); } still dont work.Why ?Where can i find informations about limitations on sololeqrn platform.How to compile code here?What should i know?
21st Aug 2023, 6:10 PM
Samir Krasnic
Samir Krasnic - avatar
0
⭐️LINK⭐️ YOUR CODE. Link your COMPLETE code so we can check on it.
21st Aug 2023, 6:14 PM
Lisa
Lisa - avatar
0
Its oke i figures it out.I just thought there are limitations usingjavascript on sololearn.It is ok now.Thanks
21st Aug 2023, 10:24 PM
Samir Krasnic
Samir Krasnic - avatar