
Документация
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
An extension to the base Drag class with additional functionality for dragging an Element. Supports snapping and droppables. Inherits methods, properties, options and events from Drag.
Drag.Move requires the page to be in Standards Mode.
var myMove = new Drag.Move(myElement[, options]);
All the base Drag options, plus:
var myDrag = new Drag.Move('draggable', { droppables: '.droppable', onDrop: function(element, droppable){ if (!droppable) console.log(element, ' dropped on nothing'); else console.log(element, 'dropped on', droppable); }, onEnter: function(element, droppable){ console.log(element, 'entered', droppable); }, onLeave: function(element, droppable){ console.log(element, 'left', droppable); } });
Checks if the Element is above a droppable and fires the drop event. Else, fires the 'emptydrop' event that is attached to this Element. Lastly, calls the Drag Class stop method.
myMove.stop();
var myElement = $('myElement').addEvent('emptydrop', function(){ alert('no drop occurred'); }); var myMove = new Drag.Move(myElement, { onSnap: function(){ // due to MooTool's inheritance, all [Drag][]'s Events are also available. this.moved = this.moved || 0; this.moved++; if(this.moved > 1000){ alert("You've gone far enough."); this.stop(); } } });
Custom Native to allow all of its methods to be used with any DOM element via the dollar function $.
Adds drag-to-move behavior to an Element using supplied options.
var myDrag = myElement.makeDraggable([options]);
var myDrag = $('myElement').makeDraggable({ onComplete: function(){ alert('done dragging'); } });
© Linux.ria.ua, 2008-2018 |