I have button that slides down a menu using Effect.BlindDown, but the function that slides it down also makes it so that the opening link now slides the menu back in. If the user double clicks the link (thuse opening & closing immediatley) the slide animation breaks, then will not extend correctly (but no JS errors). How would you go about stopping this happening? Also, is it just me or is the wiki down more often that not? Tom Rix.
Generally I just keep track of whether it''s open or not in a variable and check that variable before creating a new animation. So, only do the animation if the menu isn''t open. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... > Sent: Wednesday, January 11, 2006 4:21 AM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: [Rails-spinoffs] [scriptaculous] Intermitently DisablingClicks> > I have button that slides down a menu using Effect.BlindDown, but the > function that slides it down also makes it so that the opening link > now slides the menu back in. > > If the user double clicks the link (thuse opening & closing > immediatley) the slide animation breaks, then will not extend > correctly (but no JS errors). How would you go about stopping this > happening? > > Also, is it just me or is the wiki down more often that not? > > Tom Rix. > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I think there''s a way to check if an effect is running, but am not 100% on what it is exactly. The effect does have a state var that should be set to ''finished'' when it''s done, but there is no method to check for that, so I''m not sure if it''s recommended to use or not. if you do var e = new Effect... then you could try doing... if (e.state == ''finished'') or something similar... again, not sure if this is recommened or not. On 1/11/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote:> Generally I just keep track of whether it''s open or not in a variable > and check that variable before creating a new animation. So, only do > the animation if the menu isn''t open. > > Greg > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs- > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... > > Sent: Wednesday, January 11, 2006 4:21 AM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: [Rails-spinoffs] [scriptaculous] Intermitently Disabling > Clicks > > > > I have button that slides down a menu using Effect.BlindDown, but the > > function that slides it down also makes it so that the opening link > > now slides the menu back in. > > > > If the user double clicks the link (thuse opening & closing > > immediatley) the slide animation breaks, then will not extend > > correctly (but no JS errors). How would you go about stopping this > > happening? > > > > Also, is it just me or is the wiki down more often that not? > > > > Tom Rix. > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
I''m pretty new to Javascript (PHP is my specialty), is there a way to make ''variable variables'' ( http://nz.php.net/manual/en/language.variables.variable.php ). Say I have this function: function lockMenu(menuId) { var menu_*menuId* = true; } If I ran lockMenu(''myAccount''), I''d like the variable menu_myAccount set to false. How would I go about this? Tom. On 1/12/06, Andrew Kaspick <akaspick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think there''s a way to check if an effect is running, but am not > 100% on what it is exactly. > > The effect does have a state var that should be set to ''finished'' when > it''s done, but there is no method to check for that, so I''m not sure > if it''s recommended to use or not. > > if you do var e = new Effect... > then you could try doing... > if (e.state == ''finished'') or something similar... again, not sure if > this is recommened or not. > > On 1/11/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote: > > Generally I just keep track of whether it''s open or not in a variable > > and check that variable before creating a new animation. So, only do > > the animation if the menu isn''t open. > > > > Greg > > > > > -----Original Message----- > > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > [mailto:rails-spinoffs- > > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... > > > Sent: Wednesday, January 11, 2006 4:21 AM > > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > Subject: [Rails-spinoffs] [scriptaculous] Intermitently Disabling > > Clicks > > > > > > I have button that slides down a menu using Effect.BlindDown, but the > > > function that slides it down also makes it so that the opening link > > > now slides the menu back in. > > > > > > If the user double clicks the link (thuse opening & closing > > > immediatley) the slide animation breaks, then will not extend > > > correctly (but no JS errors). How would you go about stopping this > > > happening? > > > > > > Also, is it just me or is the wiki down more often that not? > > > > > > Tom Rix. > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
Try the eval statement... might work... function lockMenu(menuId) { eval("var menu_" + menuId + " = true;"); } -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... Sent: Wednesday, January 11, 2006 3:07 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] [scriptaculous] Intermitently Disabling Clicks I''m pretty new to Javascript (PHP is my specialty), is there a way to make ''variable variables'' ( http://nz.php.net/manual/en/language.variables.variable.php ). Say I have this function: function lockMenu(menuId) { var menu_*menuId* = true; } If I ran lockMenu(''myAccount''), I''d like the variable menu_myAccount set to false. How would I go about this? Tom. On 1/12/06, Andrew Kaspick <akaspick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I think there''s a way to check if an effect is running, but am not > 100% on what it is exactly. > > The effect does have a state var that should be set to ''finished'' when > it''s done, but there is no method to check for that, so I''m not sure > if it''s recommended to use or not. > > if you do var e = new Effect... > then you could try doing... > if (e.state == ''finished'') or something similar... again, not sure if > this is recommened or not. > > On 1/11/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote: > > Generally I just keep track of whether it''s open or not in avariable> > and check that variable before creating a new animation. So, onlydo> > the animation if the menu isn''t open. > > > > Greg > > > > > -----Original Message----- > > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > [mailto:rails-spinoffs- > > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... > > > Sent: Wednesday, January 11, 2006 4:21 AM > > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > Subject: [Rails-spinoffs] [scriptaculous] Intermitently Disabling > > Clicks > > > > > > I have button that slides down a menu using Effect.BlindDown, butthe> > > function that slides it down also makes it so that the openinglink> > > now slides the menu back in. > > > > > > If the user double clicks the link (thuse opening & closing > > > immediatley) the slide animation breaks, then will not extend > > > correctly (but no JS errors). How would you go about stopping this > > > happening? > > > > > > Also, is it just me or is the wiki down more often that not? > > > > > > Tom Rix. > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
Stay me away from eval! Well, I don''t see why, but I know the general idea that it is bad. function showProjectMenu(id) { if (menusUnlocked == ''yes'') { Effect.BlindDown(''project'' + id); lockMenus(); $(''project'' + id + ''_link'').onclick=function() { hideProjectMenu(id) } $(''project'' + id + ''_image'').src = "/images/icons/folderOpen.gif"; setTimeout(''unlockMenus()'', 1000); } } function hideProjectMenu(id) { if (menusUnlocked == ''yes'') { Effect.BlindUp(id, {duration:0.25}); lockMenus(); $(''project'' + id + ''_link'').onclick=function() { changeProject(id) } $(''project'' + id + ''_image'').src = "/images/icons/folderClosed.gif"; setTimeout(''unlockMenus()'', 250); } } function lockMenus() { menusUnlocked = ''no''; } function unlockMenus() { menusUnlocked = ''yes''; } That will lock the entire interface for the duration of the animation, only 1/4 second so its not a big deal. Tom. On 1/12/06, Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Try the eval statement... might work... > > function lockMenu(menuId) { > eval("var menu_" + menuId + " = true;"); > }
Oh, now I see. Try creating a separate class that contains that behavior, and extending each menu div (or whatever element they are), with that class... then you can use "this" within the functions to check the locked status of the individual menu. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... Sent: Wednesday, January 11, 2006 3:24 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] [scriptaculous] Intermitently Disabling Clicks Stay me away from eval! Well, I don''t see why, but I know the general idea that it is bad. function showProjectMenu(id) { if (menusUnlocked == ''yes'') { Effect.BlindDown(''project'' + id); lockMenus(); $(''project'' + id + ''_link'').onclick=function() { hideProjectMenu(id) } $(''project'' + id + ''_image'').src = "/images/icons/folderOpen.gif"; setTimeout(''unlockMenus()'', 1000); } } function hideProjectMenu(id) { if (menusUnlocked == ''yes'') { Effect.BlindUp(id, {duration:0.25}); lockMenus(); $(''project'' + id + ''_link'').onclick=function() { changeProject(id) } $(''project'' + id + ''_image'').src = "/images/icons/folderClosed.gif"; setTimeout(''unlockMenus()'', 250); } } function lockMenus() { menusUnlocked = ''no''; } function unlockMenus() { menusUnlocked = ''yes''; } That will lock the entire interface for the duration of the animation, only 1/4 second so its not a big deal. Tom. On 1/12/06, Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Try the eval statement... might work... > > function lockMenu(menuId) { > eval("var menu_" + menuId + " = true;"); > }_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
I''m happy with PHP object programming but don''t even know where to start in Javascript, let alone extending a class. Tom On 1/12/06, Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Oh, now I see. Try creating a separate class that contains that > behavior, and extending each menu div (or whatever element they are), > with that class... then you can use "this" within the functions to check > the locked status of the individual menu.
=) Sorry. I was talking about using the prototype.js library for object creation and inheritance (it ships with script.aculo.us) If I had more time today (busy now), I''d write you up an example based on your code. But for now, maybe check into the prototype library... once you learn object oriented javascript, you''ll never go back. http://www.sergiopereira.com/articles/prototype.js.html -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Tom ... Sent: Wednesday, January 11, 2006 3:37 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] [scriptaculous] Intermitently Disabling Clicks I''m happy with PHP object programming but don''t even know where to start in Javascript, let alone extending a class. Tom On 1/12/06, Ryan Gahl <Ryan.Gahl-nlycWCgr5/vuufBYgWm87A@public.gmane.org> wrote:> Oh, now I see. Try creating a separate class that contains that > behavior, and extending each menu div (or whatever element they are), > with that class... then you can use "this" within the functions tocheck> the locked status of the individual menu._______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.