Hey Mark,

Mark a écrit :
> I realise this is a ruby group, but I've got this link from

It's not a Ruby group at all.  We only use Ruby code when we explain 
usage of Rail's spinoffs-related helpers.  This group focuses on 
Prototype and script.aculo.us.

> But as I don't know how many clippings there will be at design time I
> can't get it to work and I'm not sure how to approach it.

Your client-side, JS code parses your XML data to create the DIVs.  I 
assume it can determines which ones need to become draggable.  So why 
not just add the new Draggable call to them after inserting them in the DOM?

BTW, I assume your page will also remove previous DIV sets to replace 
them with new ones when your user selects some other option?  If that is 
the case, you may want to be über-clean and deregister the draggable for 
the previous DIVs.  Failing to do so won't prevent your page from 
working, but it unnecessarily holds onto a few resources.

> What I would like is a way of looping through and making all the
> clipping divs (they each have a unique id) draggable.  I will know the

Doesn't your XML-parsing JS code already do this?  I mean, it sounds 
like it is responsible fro creating the DIVs anyway, so it doesn't even 
need their IDs: it has their HTMLElement references already.

> able to toggle the dragging on and off (as I have done in my test),
> this would be useful if a user for example wishes to highlight only a
> section of the div and not drag the whole div.

AFAIK, toggling the behavior requires destroying the draggable (calling 
destroy() on the reference you got back when doing new Draggable).  You 
would then recreate it later by using new Draggable again.

Of course, this means you keep a list of your Draggable objects somewhere...

-- 
Christophe Porteneuve aka TDD
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to