Share Posted June 14, 2019 I am using draggable on a custom keyboard. The issue I run into is when you accidentally drag on the keys the keyboard drags and the key press is not fired. My question is, is there a way to only drag a component from the background? And not allow drag on inner elements? Link to comment Share on other sites More sharing options...
Share Posted June 14, 2019 It sounds like you'd want to set dragClickables to false. From the docs. dragClickables: Boolean - By default, Draggable will work on pretty much any element, but sometimes you might want clicks on <a>, <input> <select>,<button>, and <textarea> elements (as well as any element that has a data-clickable="true"attribute) NOT to trigger dragging so that the browser's default behavior fires (like clicking on an input would give it focus and drop the cursor there to begin typing), so if you want Draggable to ignore those clicks and allow the default behavior instead, set dragClickables:false. (note: before GSAP 2.0.0, dragClickables was false by default) https://greensock.com/docs/Utilities/Draggable Hopefully that helps. Happy tweening. Link to comment Share on other sites More sharing options...
Author Share Posted June 14, 2019 Do I apply this in my create function or on the elements themselves? I am also using Vue.js by the way. Link to comment Share on other sites More sharing options...
Share Posted June 14, 2019 Here's a basic setup. See the Pen MMKjyG by PointC (@PointC) on CodePen Happy tweening. 1 Link to comment Share on other sites More sharing options...
Author Share Posted June 14, 2019 Is there a way to apply that to specific divs? And not just buttons? Link to comment Share on other sites More sharing options...
Share Posted June 14, 2019 See the Pen JQGRpP by PointC (@PointC) on CodePen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now