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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -