Tween onComplete - for special fade.

217 views
Skip to first unread message

idan Hen

unread,
Sep 10, 2012, 4:44:24 PM9/10/12
to mootool...@googlegroups.com
Hey , 

i have a site i am building , i have a content div and in my header i have login button.
when i click the login button , i mask the content div , and display a float div above it.

so far its all good :) , i have a close button to close the floating div and unmask the content div.

the issue is : 
when i fade('out') , i want to unmask onComplete. -> the problem is this effect the fade('in') also !!

set("tween", {
            onComplete: function(o) {
                $('content').unmask();
            }
        }).

how can i set a "onComplete" to each fade ... -> they are both running on the same element ..... 

Sanford Whiteman

unread,
Sep 10, 2012, 4:48:31 PM9/10/12
to idan Hen
In jsFiddle so we can run and edit it?

-- Sandy

idan Hen

unread,
Sep 10, 2012, 4:57:35 PM9/10/12
to mootool...@googlegroups.com
Yes , ofcourse :) my bad.

idan Hen

unread,
Sep 10, 2012, 4:59:24 PM9/10/12
to mootool...@googlegroups.com
I think the main issue is , i want to create a tween fade in and out , from the same button.
which will mask/unmask onComplete . 

Sanford Whiteman

unread,
Sep 10, 2012, 5:04:54 PM9/10/12
to idan Hen
The jsFiddle doesn't run -- in the HTML box, you want to put just the
innerHTML of the BODY, and you also refer to $('page_login_wrapper')
and I don't see such an element.

-- S.

idan Hen

unread,
Sep 11, 2012, 6:06:41 AM9/11/12
to mootool...@googlegroups.com
I understand , 

its hard to do it , but basicly the request i have is : 
a div , that on tween fade in complete will do 1 thing , and on tween fade out complete will do something else.

since jquery has callback function -> its easy , and in mootools i have a problem.

since the onComplete function will run for both fade in and out !



On Monday, September 10, 2012 11:44:24 PM UTC+3, idan Hen wrote:

Matthew Hazlett

unread,
Sep 11, 2012, 6:19:25 AM9/11/12
to mootool...@googlegroups.com
In the onComplete couldn't you just check the opacity of the object?

0 = fade out
1 = fade in

idan Hen

unread,
Sep 11, 2012, 6:27:18 AM9/11/12
to mootool...@googlegroups.com
OK , i found a simple yet not a good looking solution.
tell me what you guys think .... I had to clean the event after each time .... 

/* the fade in */
$('page_login_wrapper').reveal().set("tween", {
                onStart: function() {
                    Dreams.Log.info('onStart hit');
                    $('content').mask();
                    pageLoginWrapper.get('tween').removeEvents('onStart');
                }
            }).fade('in'); 
/* the fade out */
 $('page_login_wrapper').dissolve().set("tween", {
            onComplete: function() {
                $('content').unmask();
                $('page_login_wrapper').get('tween').removeEvents('onComplete');
            }
        }).fade('out'); 


On Monday, September 10, 2012 11:44:24 PM UTC+3, idan Hen wrote:
Reply all
Reply to author
Forward
0 new messages