Loading ...
Sorry, an error occurred while loading the content.

Listening for Drag and Drop events

Expand Messages
  • Michael Richard Murphy
    I recently discovered Yahoo! UI and I m in the process of implementing drag and drop functionality. I have a list of terms and definitions. Users can drag
    Message 1 of 1 , Jul 31, 2006
      I recently discovered Yahoo! UI and I'm in the process of implementing drag and drop functionality.  I have a list of terms and definitions.  Users can drag divs containing the definitions onto divs containing the terms.  I tried using the targetable drop and drop example as a starting point but I've gotten stuck at listening for events from the definitions.

      I've assigned my terms as targets like so:
      slots[0] = new YAHOO.util.DDTarget("t_need_fund_opt");

      and definitions:
        players[0] = new YAHOO.util.DDProxy("p_need_fund_opt");
        players[1] = new YAHOO.util.DDProxy(blah);

      Right now I test for events like onDragEnter, onDragOut, and onDragDrop like this:
        players[0].onDragOut = function(e, id) {
          do some stuff...

      I have all the events I want to test for working the way I want but I'm not sure how to refactor them so that I can listen for events on all the items in my players array.

      Any help would be greatly appreciated.  I've tried dissecting the examples to understand how it's being done but I must have some mental block that's preventing me from figuring it out.

      Thanks in advance,
    Your message has been successfully submitted and would be delivered to recipients shortly.