Hi Christophe,
Many thanks for your response, it is much appreciated. > 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? Yes my javscript runs through the XML and creates the divs, so if I knew how to associate them here I would. So far I have only used the calls in the onload i.e. window.onload=function() { mydrag_1 = new Draggable('clipping_1', {revert:true,ghosting:true}); mydrag_2 = new Draggable('clipping_2', {revert:true,ghosting:true}); mydrag_3 = new Draggable('clipping_3', {revert:true,ghosting:true}); } I think this is the biggest reason for me having problems, I'm not quite sure how else to apply the calls, or get a handle on draggable objects that haven't been specifically associated with a global variable. How would I apply the draggable call to the div when I'm creating it at run time? > 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. Yes when the user selects a different category from the drop down list the clipping divs are all removed from the DOM and the new ones added. I would want to deregister the draggable divs when they were removed if possible, again I'm not sure how I would get a handle on them to remove them (I'm sure this will make more sense when I see how to apply the draggable call to the divs during creation in the first place). > 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. Yes my XML does loop through and create the divs, I would love to add the dragable calls here, I'm just really not sure how. I have read the info on the scriptaculous wiki and I'm still none the wiser. If I want to add the calls in the onload then no worries, it works absolutley fine (as in my example above) otherwise I'm really not too sure. Perhaps I'm just being a bit silly, but I would definitley appreciate any examples etc. > 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. Yes, in my static example above I disable and enabled the dragging by setting global variables with the create draggable calls then calling destroy on them i.e. function disableDragging() { mydrag_1.destroy(); mydrag_2.destroy(); mydrag_3.destroy(); } But again (and this is really my confusion in a nutshell at the moment) I'm not sure how I would destroy the draggable behaviour if I haven't got a variable to call destroy on. Again a code example or something would be a great deal of help. I really just need to understand how to dynamically apply and remove the draggable behaviour rather than just having static elements setup at design time. Thanks again for taking the time to reply. Mark --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---