Deprecated: Function set_magic_quotes_runtime() is deprecated in /home4/mfoster/public_html/cb/forums/include/common.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 31

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home4/mfoster/public_html/cb/forums/include/common.php:62) in /home4/mfoster/public_html/cb/forums/header.php on line 34
Cross-Browser.com / only once during animation

Cross-Browser.com

X Library Forums

You are not logged in.

Announcement

New user registration is currently disabled.

#1 February 11, 2011 7:56:00 am

sharethewisdom
New Member
Registered: February 6, 2009
Posts: 6

only once during animation

hi,
I try to figure out a way to trigger a function with a mouseover only once during an animation. I tried messing with timers..
When the animated opacity of a div reaches its target opacity (1), a timer must be executed that triggers a second animation of the opacity (1->0). Only after the second animation the function may be triggered again. how do i go'round doing this? somthing like:


var t;
var hover_timer_is_on=0;
var fadeout_timer_is_on=0;

function onMouseOver()
{
if (!hover_timer_is_on)
    {
    hover_timer_is_on=1;
        run FadeIn() only once until hover_timer_is_on=0 ?
    }
}

function FadeIn(xa)
{
    var l = xGetElementById('left');
    xOpacity(l, 0);
    if (!xa) xa = new xAnimation();
    xa.opacity(l, 1, 400, 0, 0, start fadeout timer function);
}

function doFadeoutTimer()
{
fadeout_timer_is_on=1;
(...)
xa.opacity(l, 0, 200, 0, 0, hover_timer_is_on=0);
}


thanks. I know it's elementary knowledge and logic...
bart

Offline

 

#2 February 14, 2011 9:54:18 pm

MikeFoster
Administrator
From: Alabama, USA
Registered: April 27, 2007
Posts: 874
Website

Re: only once during animation

Hi sharethewisdom, I apologize for the late reply.

Yes, I think you have the right idea. You could even store that flag as a property on the animated element itself.

Offline

 

Board footer

Powered by PunBB 1.2.15
Copyright © 2002–2005 Rickard Andersson

Expand Restore Select Format Eval Load