Mootools Draggable / Resize Example

/ Published in: JavaScript
Save to your folder(s)

Very simple drag and resize function.

Copy this code and paste it in your HTML
  1. function resizeDrag(){
  2. //create an array of elements with class 'drag'
  3. var draggables = $ES('.drag');
  4. //For each of the above elements run this function(pass in the selected function el)
  5. draggables.each(function(el){
  6. //Make the element dragable. Draging starts on the element with class = handle
  7. el.makeDraggable({handle: el.getElementsBySelector('.handle')[0]});
  8. //Make the element resizable. Resizing starts on the element with class = resize
  9. el.makeResizable({handle: el.getElementsBySelector('.resize')[0]});
  10. });
  11. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.