Little bit of help with Morph

30 views
Skip to first unread message

Roo

unread,
Mar 28, 2013, 12:13:36 PM3/28/13
to mootool...@googlegroups.com
Hi all,

Just looking for a bit of help about what to do when you want to reverse the effects of a morph.

http://jsfiddle.net/CjNyJ/

I'm highlighting table rows when the mouse rollovers and I'd like to use a gentle transition rather than apply a class immediately and then remove it (incidentally that works fine).

If I use Morph to morph to the hover over class I get a lovely transition. The CSS changes are applied within the style property of the element.

Is it possible to reverse the effects of a morph..?

In the JSFiddle above I have tried removing the style property on mouse out. This works ok but if you move the mouse quickly the style never gets removed and the element remains, in this case, blue, and it will also remove any styles that happen to be applied to the row for whatever reason.

Is it possible to ensure that the style is removed on mouseout when the mouse is moving quickly..?

Thanks
Rolf

Arian Stolwijk

unread,
Mar 28, 2013, 12:17:53 PM3/28/13
to mootool...@googlegroups.com
you can save the initial styles: http://jsfiddle.net/CjNyJ/1/

Also it's better to have one Fx.Morph instance for each element (rather than creating a new one each time you mouseenter).


--
 
---
You received this message because you are subscribed to the Google Groups "MooTools Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mootools-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Roo

unread,
Mar 28, 2013, 12:34:48 PM3/28/13
to mootool...@googlegroups.com
OK thanks for that makes sense.

How about my second question;

http://jsfiddle.net/CjNyJ/3/

if you move the mouse down the column of divs the reversal doesnt happen though according to my Firebug the mouse out event is firing..?

Thanks again

Johnny Fuery

unread,
Mar 28, 2013, 12:49:35 PM3/28/13
to mootool...@googlegroups.com
My guess, sans any investigation, is that the first transition is still running.  Looks to me (Chrome on Mac) like if you're patient with it, the transitions are working as expected.

Assuming yes, you'll need to test for whether a transition is currently running and either chain or cancel within both of your event handlers.

Johnny

Aaron Newton

unread,
Mar 28, 2013, 1:34:15 PM3/28/13
to mootool...@googlegroups.com
For this particular use case, might I suggest that you have a css3 transition instead? Just do a crossfade for tr:hover.

Rolf Herbert

unread,
Mar 28, 2013, 1:47:20 PM3/28/13
to mootool...@googlegroups.com
Hi Aaron,

That is indeed what I have done but I was interested in the how and whys and Ive been enlightened!

Rolf


From: Aaron Newton <anu...@gmail.com>
To: mootool...@googlegroups.com
Sent: Thursday, 28 March 2013, 17:34
Subject: Re: [Moo] Little bit of help with Morph

You received this message because you are subscribed to a topic in the Google Groups "MooTools Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mootools-users/hNkiDTxYSRk/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to mootools-user...@googlegroups.com.

Sanford Whiteman

unread,
Mar 28, 2013, 2:47:06 PM3/28/13
to Rolf Herbert
> That is indeed what I have done but I was interested in the how and whys and Ive been enlightened!

Just for tidiness, what Johnny was referring to:

http://jsfiddle.net/CjNyJ/4/

-- S.

Rolf Langenhuijzen

unread,
Mar 29, 2013, 9:07:31 AM3/29/13
to mootool...@googlegroups.com
Gee, I thought I was the only Rolf using Moo.

...sorry, this post doesn't add anything useful to the thread, lol!
Reply all
Reply to author
Forward
0 new messages