This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Hover effect and propagation. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Hover effect and propagation." Watch "Hover effect and propagation." New topic
Author

Hover effect and propagation.

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 410

Hi,

I have a drop down menu. See jsfiddle. When I over on Programming it shows me a dropdown. But when I hover over first element in this case Java. It run the event on parent as well. I am not sure what is the issue. In case I try to stop propagation. It doesn't work properly see jsfiddle. Please let me know if I am doing something wrong.
Thanks.


Pawan Chopra
SCJP - DuMmIeS mInD
Rob Crowther
author
Ranch Hand

Joined: Nov 06, 2012
Posts: 295
    
    5

Your problem is that you're capturing hover events on all elements - UL, LI and A. Try checking the nodeName property of the target before initiating your animation. Example.


Read my books: Hello! HTML5 & CSS3 | HTML5 in Action | Read my blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hover effect and propagation.