Its_Lefty Posted June 27, 2022 Share Posted June 27, 2022 Hi there! With Swiper JS you can wrap your text with a span element with class swiper-no-swiping to disable swiping on the text and allow selecting it. Is this somehow possible with GSAP Draggable? Thanks in advance! Link to comment Share on other sites More sharing options...
GreenSock Posted June 28, 2022 Share Posted June 28, 2022 I'm a little confused - are you saying you created a Draggable on certain elements that you don't want to be draggable? Please make sure you include a minimal demo if you'd like some help. It really helps to see the issue in context. Link to comment Share on other sites More sharing options...
Its_Lefty Posted June 28, 2022 Author Share Posted June 28, 2022 6 hours ago, GreenSock said: I'm a little confused - are you saying you created a Draggable on certain elements that you don't want to be draggable? Yes. I know it seems a bit odd. It was more of a general question. For example if I have a fullscreen draggable section and there is something like a phone number, which you want to select. I've tried simply adding user-select: text and cursor: text to the element but obviously this didn't work and I guess you need JS here. By default there is no such option using Draggable, correct? Here is a Swiper JS example: See the Pen YzazPOr by ItsLefty (@ItsLefty) on CodePen Link to comment Share on other sites More sharing options...
Solution akapowl Posted June 28, 2022 Solution Share Posted June 28, 2022 1 hour ago, Its_Lefty said: By default there is no such option using Draggable, correct? Setting dragClickables: false in your Draggable alongside data-clickable="true" on your element would make that possible,@Its_Lefty https://greensock.com/docs/v3/Plugins/Draggable 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. See the Pen JjLPQde by akapowl (@akapowl) on CodePen 3 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