Yep, working on that now :)




On Wed, Sep 9, 2009 at 4:44 PM, Chris Sansom <[email protected]> wrote:

>
> At 14:39 -0400 9/9/09, Rick Waldron wrote:
> >Since you say your are just learning, I'd like to impart a tip :)
> >
> >
> >Instead of...
> >
> >    Droppables.add('DropDiv_G1', {
> >      hoverclass: 'hover',
> >      accept: 'G1',
> >      onDrop: DropHandler
> >    });
> >
> >    Droppables.add('DropDiv_G2', {
> >      hoverclass: 'hover',
> >      accept: 'G2',
> >      onDrop:  DropHandler
> >    });
> >
> >    Droppables.add('DropDiv_G3',  {
> >      hoverclass: 'hover',
> >      accept: 'G3',
> >      onDrop: DropHandler
> >    });
> >
> >
> >
> >try....
> >
> >var droppableDivs = ['DropDiv_G1', 'DropDiv_G2', 'DropDiv_G3'];
> >
> >droppableDivs.each(function (_div) {
> >   Droppables.add(_div, {
> >      hoverclass: 'hover',
> >      accept: 'G3',
> >      onDrop: DropHandler
> >   });
> >});
> >
> >
> >Cleaner and DRYer :)
>
> ...except that in the original they accepted G1, G2 and G3 in turn,
> rather than all accepting G3, so you'd have to jump through an extra
> hoop in your loop. :-)
>
> --
> Cheers... Chris
> Highway 57 Web Development -- http://highway57.co.uk/
>
> My best advice to anyone who wants to raise a happy,
> mentally healthy child is: Keep him or her as far away
> from a church as you can.
>    -- Frank Zappa
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to