Put a handle on mooTools Drag.Move
In the next version of List Central the little popup form that enables the user to edit list items will be dragable so that the list maker can move it to where ever they would prefer to have it. It is a great little feature that really adds to the usability of List Central.
When I was implementing the dragable popup form feature I was pleased at how easy it was to use mooTool’s Drag.Move. My little form was easily moved to anywhere in the browser window, just as I intended. A problem arose when I tried to use the form inside the dragable element. The input elements of the form were not clickable, I could not get them to have focus, as if they were behind an invisible layer, which is actually what was going on. The form elements inside the dragable div they sitting in were not clickable, because they were dragable! Ack!
Happily I was able to find a solution for my problem: the dragable element required a handle.
The above image shows the Drag.Move handle in the upper right corner of the edit list item form div. You cannot move that dragable element unless you grab it by the handle, the move icon. Using a handle frees up the rest of the element for other clickable elements, like a form.
The JavaScript for including a handle in your Drag.Move element is as follows:
new Drag.Move('dragableDivID', {handle: 'dragHandleID'});
and the HTML, with some CSS:
<style>
.dragHandle{
background:transparent url(/images/move.png) no-repeat scroll 0 0;
cursor:move;
float:right;
height:30px;
margin:15px 15px 0 0;
width:30px;
}
</style>
<div class='dragableBox' id='dragableDivID'>
<div class='dragHandle' id='dragHandleID'></div>
<div class='dragableInner'> The content goes here</div>
</div>
In looking for this solution I found this great tutorial series by Consider:open called 30 Days of mooTools. The entire series is very well done. Web developers at any level are likely to learn something new about mooTools there. Check out thethe tutorial on Drag.Move from the series that helped me out.















Discussion