我在 Mootools 网站上的论坛上问过这个问题,有人说我的班级选择在管理员出现并将我的帖子状态更改为无效之前已损坏。不用说,这并没有多大帮助。然后我发布到谷歌组的 Mootools 没有回应。我的问题是为什么我的 '.drop' 元素不会触发 'enter'、'leave'、'drop' 事件?.drag 元素的事件正在运行。
<title>Untitled Page</title>
<script type="text/javascript" src="/SDI/includes/mootools-1.2.js"></script>
<script type="text/javascript" src="/SDI/includes/mootools-1.2-more.js"></script>
<script type="text/javascript" charset="utf-8">
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();
}
});
});
});
</script>
<form id="form1" runat="server">
<div>
<div id="draggables">
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
<div class="drag"></div>
</div>
<div id="droppables">
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
<div class="drop"></div>
</div>
</div>
</form>