http://apw-design.com/ Taking a look at this webpage, I have a div id which starts off as a thin line across the page. When the mouse enters the menu the box moves across it and across part of the logo, when the mouse then enters the logo directly from the menu it changes color correctly but uses the mouse leave animation from the menu. If you scroll from the page across to the logo, it shows what the box should transform to.
The scrip for the animations is below:
http://pastebin.com/wU4c10NJ
I’ve uploaded the css file as well for reference:
http://pastebin.com/RgWZQTD9
It looks like the problem is your
eachDelayfunction inside your menus ‘mouseleave’ function. The delay will cause your#whitelineanimation to fire after your logos ‘mouseenter’ function. Heres the chain of events:mouseleavefireseachDelayloops through menu itemsmouseenterfireseachDelayreaches last item and overrides LogomouseenterWhat you could do is introduce a variable to check if the menu no longer has focus and only fires the
#whitelineanimation if the cursor isn’t on the logo. Here’s a simplified example:A useful debugging tip is to use
console.log("Event foo fired");at the points in your script that do the animation, that way you open your browser console and tell if the order of things is a little off.