Note that there are some explanatory texts on larger screens.

plurals
  1. POMootools: Drag and Drop problem
    text
    copied!<p>I've asked this question to the forums on the Mootools website and one person said that my class selection was corrupted before an admin came along and changed my post status to invalid. Needless to say this did not help much. I then posted to a google group for mootools with no response. My question is why doesn't the 'enter', 'leave', 'drop' events fire for my '.drop' elements? The events for the .drag elements are working.</p> <pre><code>&lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type="text/javascript" src="/SDI/includes/mootools-1.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/SDI/includes/mootools-1.2-more.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; window.addEvent('domready', function() { var fx = []; $$('#draggables div').each(function(drag){ new Drag.Move(drag, { droppables: $$('#droppables div'), onDrop: function(element, droppable){ if(!droppable) { } else { element.setStyle('background-color', '#1d1d20'); } element.dispose(); }, onEnter: function(element, droppable){ element.setStyle('background-color', '#ffffff'); }, onLeave: function(element, droppable){ element.setStyle('background-color', '#000000'); } }); }); $$('#droppables div').each(function(drop, index){ drop.addEvents({ 'enter': function(el, obj){ drop.setStyle('background-color', '#78ba91'); }, 'leave': function(el, obj){ drop.setStyle('background-color', '#1d1d20'); }, 'drop': function(el, obj){ el.remove(); } }); }); }); &lt;/script&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;div id="draggables"&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;div class="drag"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="droppables"&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;div class="drop"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload