var myEffect = new Effect.effectName( effectOptions );
myEffect.cancel();

For real time answers and more, check out effects.js and look under Effect.base 
and Effect.theEffectYouWantToLearnAbout

-Andrew Martinez

 -----Original Message-----
From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]  On Behalf Of Brice Burgess
Sent:   Monday, May 22, 2006 3:38 PM
To:     [email protected]
Subject:        [Rails-spinoffs] Canceling a specific effect

Is there a way to cancel a specific effect? For instance; Effects are 
added to the queue. Before actually processing the effect, I'd like to 
check a condition & cancel the effect if necessary.

Here's the code excerpt:
var menu = {
    toggleText: function(element,toggle) {
        var vis = $(element+'Text').visible();
        if (toggle && !vis) { // toggle text ON
            new Effect.BlindDown(element+'Text', {queue: {scope: 
'headers', position:'front'}});
        }
        else if (!toggle && vis && this.currentHeader != element) {
            new Effect.BlindUp(
                element+'Text',
                {
                    queue: {scope: 'headers', position:'end'},
                    beforeStart: function() {
                        if (menu.currentHeader == element) {
                            this.cancel();
                        }
                }
            });
        }
    },

    I'm not sure that this.cancel(); cancels the effect, nor that the 
comparisson (currentHeader == element) remains static to the original 
element the Effect was called for.

Any ideas?

Thanks,

~ Brice Burgess

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to