briangonzalez / jquery.pep.js

👟 Pep, a lightweight plugin for kinetic drag on mobile/desktop
http://pep.briangonzalez.org
1.3k stars 177 forks source link

Possible to designate a "handle" like .draggable() in other libraries? #202

Open ScottBeeson opened 7 years ago

ScottBeeson commented 7 years ago

This would be super useful.

seanCodes commented 7 years ago

@ScottBeeson Can you describe what you have in mind in a little more detail? Would you be open to submitting a PR?

ScottBeeson commented 7 years ago

I'll see if I can do a pull, but it may be a bit out of my league (and/or require more time than I have).

Basically, with JQuery.draggable you can pass handle: #element so that the entire thing is only dragged using the specified element. I did discover that I can sort of do the reverse with pep by using elementsWithInteraction.

<div id="draggable">
  <div id="handle">H</div>
  <div id="content">This is text, but you cannot use the mouse to drag it around</div>
</div>

So for JQuery you would use handle: #handle but I think for pep doing elementsWithInteraction: #content will have the same result.

It's not identical, but I think it works as a workaround in most situations.