I’m developing a drag-and-drop plugin for jQuery. It’s going well, but I don’t know how to implement the handle feature, which is very important in such a plugin.
I really don’t know how to get this to work. Here is my plugin so far: http://jsfiddle.net/shawn31313/BggPn/49/
How can a handle feature be implemented?
Well basically, “handle” feature is an ability to pass the selector of draggable’s child element, and only when user click on that child element, will dragging be initiated for the parent.
So, in order to implement it in your plugin, you have to create another option, for the selector of a handle, and in your mousedown handler, first check event’s target to see if it matches the handle selector. If it does, continue as is, if it doesn’t, do not start dragging.