ga-wdi-exercises / project1

[project] GA- Project 1
3 stars 75 forks source link

issue with mouseover functionality #236

Closed winishahines closed 8 years ago

winishahines commented 8 years ago

I tried adding mouseover and mouseout functionality to my game. I'd like to add it to each div but I could only figure out how to add it to the entire body. My repo link is here and my question is about lines 53-60.

nolds9 commented 8 years ago

Hi Winisha, can you include a snippet of code where you are adding the event listeners? The link goes to your deployed site. Looks great btw!

nolds9 commented 8 years ago

So just looking at the current js code in script.js looks like all the events for the particular div being created on line 39 are firing correctly. I guess my question is what is are you expecting to happen?

nolds9 commented 8 years ago

I would log the value of this inside your changeBackgroundToColor functions. You could you use that value in order to change the appropriate element's color.

winishahines commented 8 years ago

snip20160224_2

I'm trying to figure out a way to edit the code that appears on lines 56 and 59 so that a color change will happen when mousing over each individual div. I need to be able to select each div that's housed within document.body. Any suggestions?

nolds9 commented 8 years ago

Currently on those events you are changing the body's background-color. Going to refer to my previous suggestion:

I would log the value of this inside your changeBackgroundToColor functions. How could you use that value in order to change the appropriate element's color?