Hi, You can disable the buttons while the morph is in progress; that way not only do you prevent the click event but you give the user feedback that they can't click the buttons right now. Otherwise, you have these nice clickable buttons but the clicks are ignored -- users hate that. ;-)
If you don't want to disable the buttons, you can use a flag like your `effect_in_progress` flag that all of the buttons involved share (rather than a flag specific to each individual button). HTH, -- T.J. Crowder Independent Software Consultant tj / crowder software / com www.crowdersoftware.com On Apr 23, 4:47 am, patrick <[email protected]> wrote: > Hi, > > I have something like this (using lowpro): > ------------------ > <button id="foo"> > <button id="bar"> > > <div id="something"></div> > > ... > > Event.addBehavior({ > 'button:click': function() { > if (self.effect_in_progress) { > return false; > > } > > var new_height = (this.id == 'foo') ? 50 : 100; > this.effect_in_progress = true; > > new Effect.Morph('something', {style: {'height': new_height + > 'px'}, afterFinish: function() { > this.effect_in_progress = false;}); > } > }) > > ------------------ > > but the problem I am having is, if I click on the 2nd button while the > first is in progress, immediately after the morph is complete it fires > again and does the 2nd morph... I am wondering if there is a way that > I can discard any events that occur while the effect is in progress, > so that way all clicks will be ignored and forgotten while the morph > is happening, but once it's complete it will accept an individual > click event. I tried doing Event.stop(event)-- but that didn't do > it... > > Thanks. > > -patrick > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/prototype-scriptaculous?hl=en. -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
