Special events

Special events extensions add a set of special events plugins.

$.Drag and $.Drop

The $.Drag and $.Drop plugins contain the drag and drop events.

Let's paste the following code into the jquerymx_draganddrop.js file:

steal(
    'jquery/event/drag',
    'jquery/event/drag/limit',
    'jquery/event/drag/scroll',
    'jquery/event/drag/step',
    'jquery/event/drop',
    function ($) {

        $('body').append('<p>Drag me, but not too far...</p>'),

        $('p').bind('dragmove', function (e, drag) {
            if (drag.location.top() > 150 || drag.location.left() > 450) {
                console.log('limiter'),
                e.preventDefault();
            }
        });
    }
);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.44.143