Документация
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
на русском v1.2.5 Документацитя по MooTools 1.4.5 Обсуждение Установить себе Благодарности
Enables the modification of two CSS properties of an Element based on the position of the mouse while the mouse button is down.
var myDragInstance = new Drag(el[, options]);
var myDrag = new Drag('myDraggable', { snap: 0, onSnap: function(el){ el.addClass('dragging'); }, onComplete: function(el){ el.removeClass('dragging'); } }); //create an Adobe reader style drag to scroll container var myDragScroller = new Drag('myContainer', { style: false, invert: true, modifiers: {x: 'scrollLeft', y: 'scrollTop'} });
Attaches the mouse listener to the handle, causing the Element to be draggable.
myDrag.attach();
var myDrag = new Drag('myElement').detach(); //The Element can't be dragged. $('myActivator').addEvent('click', function(){ alert('Ok, now you can drag.'); myDrag.attach(); });
Detaches the mouse listener from the handle, preventing the Element from being dragged.
myDrag.detach();
var myDrag = new Drag('myElement'); $('myDeactivator').addEvent('click', function(){ alert('No more dragging for you, Mister.'); myDrag.detach(); });
Stops (removes) all attached events from the Drag instance and executes the 'complete' Event.
myDrag.stop();
var myDrag = new Drag('myElement', { onSnap: function(){ this.moved = this.moved || 0; this.moved++; if(this.moved > 100) { this.stop(); alert("Stop! You'll make the Element angry."); } } });
Custom Native to allow all of its methods to be used with any DOM element via the dollar function $.
Adds drag-to-resize behavior to an Element using supplied options.
var myResize = myElement.makeResizable([options]);
var myResize = $('myElement').makeResizable({ onComplete: function(){ alert('Done resizing.'); } });
© Linux.ria.ua, 2008-2024 |