My basic set up is that I have some divs which I want to fade in and out when the user hovers over an image.
Code:
<div id="DefaultHint" >The default hint is in here, shown initially</div>
<div id="PPHint" style="display:none" >There is a different hint here, hidden initially</div>
Nope, that makes it a little different but now I see both hints at once for a millisecond on the transition as well as when I hover in and out too fast!
Nope, that makes it a little different but now I see both hints at once for a millisecond on the transition as well as when I hover in and out too fast!
because your making it to fadeIn Fadeout fast make it.. fadeIn('slow'); and fadeOut('slow')
I suspect the problem with your original code is because when you move the mouse in and out quickly, the hoverIn fade has not completed before the hoverOut fade starts - resulting in both divs being visible.
Edit: I got ninja replied on by SB65. This post is supposed to go just above his!
That doesn't fix it either I'm afraid. The problem is that there's nothing preventing the mouseout function from running at the same time as the mousein function when I move the mouse in and out of the image quickly. When both functions run at the same time, I see both hints at the same time.
So what I think I need to do is check if the mousein function is finished before I run the mouseout function somehow?
Last edited by Left_blank; 08-19-2010 at 01:22 PM..
That does ease the problem somewhat but it doesn't eradicate it. When I flash the cursor back and forth over the image quickly I still see both divs at once sometimes. There are also instances of the functions being queued up in memory so if I flash over a lot of times and then move the mouse away there is still animations going on.
I'd guess I can add some sort of timer to the function so that nothing happens unless there is hover for a certain length of milliseconds. I'll try that and let you know how I get on.