Sorry for such a basic question, but I need to know how to add a class to two divs, #left-arrow and #right-arrow when I hoverover #leaderboard.
I understand I can use the call hover(), but I’m unsure how to implement it to add a class on another element.
I’m definitely a beginning with Javascript, so the more specific on how to implement it the better! Thanks!
-Judson
You can use
.toggleClass(), like this:This adds the class when you hover, removed it when the mouse leaves. If you want to just add the class, then
.addClass()will work and you can manually remove it with.removeCass()later.For this part:
Just use a selector like I have above, you’re not restricted to using
thisinside any function, you can use a selector or traverse functions to move around wherever appropriate.