Dragging by using a handle. #66

matula opened this Issue Aug 14, 2014 · 6 comments


None yet

5 participants

matula commented Aug 14, 2014

This is a great library, thanks for the work and releasing it!
I was wondering if there was a way to make an element draggable, but only by clicking a handle in the element? That way, the whole element isn't clickable. Thanks!

taye commented Aug 15, 2014

There's no setting for this so you would have to change the target yourself in your event listeners.

I could implement something like an allowFrom options which would be sort of the reverse of ignoreFrom to only start actions from the matching element or it's children.

taye commented Aug 31, 2014

I've implemented the allowFrom setting.

     * A drag/resize/gesture is started only If the target of the
     * `mousedown`, `pointerdown` or `touchstart` event or any of it's
     * parents match the given CSS selector or Element.



prolly a non-issue but:


shouldn't this be this._element.querySelector to restrict drag handles to child nodes only? there is no need to take other matching elements into consideration

taye commented Sep 4, 2014

You're right, it should only focus on the child nodes. However, the line that you mentioned is only there to test that the given string is a valid CS selector. I've implemented the behaviour in d67646e for both allowFrom and ignoreFrom.

Thanks for mentioning this!

@taye taye closed this Sep 14, 2014

Can you give a sample code snippet about the implementation? Thanks great framework

dpekkle commented Mar 22, 2016

Here's an implementation based on someone elses jsfiddle.


You can only drag/drop using the handle provided due to
line 2: allowFrom('.handle')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment