javascript - Image doesn't get hidden -


i developing pacman since lab assignment. , try hide food(image) when pacman reaches it. code used working :

if((parseint(image1.style.left)>=(parseint(s1.style.left))) && (parseint(image1.style.left)<=(parseint(s1.style.left)+100)) &&          (parseint(image1.style.top)+30>=(parseint(s1.style.left) && parseint(image1.style.top)+30<=(parseint(s1.style.left)+100))))       {var e= document.getelementbyid('s1');      e.style.visibility='hidden';     } <img id="s1" src="s.gif" style="position: fixed; top:50; left:100" /> 

now problem i'm using exact same code food not working. here :

<img id="s5" src="s.gif" style="position: fixed; top:150; right:700" />  if((parseint(image1.style.left)>=(parseint(s5.style.left))) && (parseint(image1.style.left)<=(parseint(s5.style.left)+100)) &&          (parseint(image1.style.top)+30>=(parseint(s5.style.left) && parseint(image1.style.top)+30<=(parseint(s5.style.left)+100))))       {var e= document.getelementbyid('s5');      e.style.visibility='hidden';     } 

it solved. changed right attribute left , works fine.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -