On Sep 13, 2011, at 10:29 AM, Chris Sansom wrote:

Been off this list for ages, as I've not done any of this kind of work for some time. As a consequence I'm a bit rusty...

OK, an explanation of what I'm trying to do. I have a <div> which consists of a row of three nested <div>s inside each of which are various elements, including links. The client wants this whole row of three to crossfade with a different set of three at regular intervals (I'm using 3 seconds with a two second fade time for testing purposes). They also want the crossfading to pause when the mouse is rolled over anywhere in the whole set of three, and resume on mouseout.

I have two empty enclosing <div>s in the html page, pinned to the same spot with css. I use a Periodical Executer to do an Effect.fade() and Effect.appear() to crossfade them. This all works fine, but with the mouseover/-out part all hell can break loose!

I first tried it with a simple pair of boxes, one green saying 'Hello' and one blue saying 'Goodbye', and this worked perfectly, but with the more complex version I'm running into what I think must be bubbling problems - and this is where I get a bit out of my depth, I'm afraid. I /think/ what's happening is that when you roll the mouse over various elements inside the <div> JS thinks it's mousing out and over repeatedly, so the animation goes nuts and at times disappears altogether. If you simply roll over one of the images, then straight out of the whole enclosing <div> again, on the other hand, the pause and resume works fine.

It could well be that I'm approaching this completely the wrong way...

Take a look at mouseenter/mouseleave (added in 1.6.something) as that will definitely do what you need it to do. There's a long-hand way of checking a mouseout to see if it actually "left the building" or not (rather than just mousing over a child within the same element you're observing).

Walter

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to