Mootools: drag and drop problems

I asked this question in the forums on the Mootools website, and one person said that my class selection was corrupted before the administrator came and changed the status of my message to invalid. Needless to say, this did not help much. Then I sent to the Google group for Mootools unanswered. My question is: why are the events "enter", "exit", "drop" not triggered for my ".drop" elements? Events for .drag elements work.

<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>
+3
source share
2 answers

, , . , mootools , "droppable". , , 'enter', 'leave' 'drop' . ( )

, mootools ( DOM), . , 'enter' 'leave' "mouseover" "mouseout", . (Opera 9.51 Windows Vista)

, -, , DOM.

http://docs.mootools.net/Element/Element.Event#Element:addEvents

, ,

http://www.w3schools.com/html/html_eventattributes.asp

"TG in SD" nabble, , . , , . , , .

+3

Mootools Docs, "droppables" , Drag.Move. , , , "drop," enter, <<24 > .

+1

Source: https://habr.com/ru/post/1696407/


All Articles