ngc7293 Posted April 2, 2022 Share Posted April 2, 2022 Hi, this is the plug-in I want, but now I have some problems. When I disable the plug-in during the drag process, it still runs, even if the mouse is released. You can see that the console is continuously outputting... In fact, I want to realize the function of locking the axis, just like the Draggable, Or I can disable default events dynamically. I hope I have made myself clear. See the Pen jOLNLZE by xf-ngc7293 (@xf-ngc7293) on CodePen Link to comment Share on other sites More sharing options...
Cassie Posted April 2, 2022 Share Posted April 2, 2022 Hey! Not really sure what's happening here but that disable statement is running quite a lot. Not sure what the aim for that was, but without it it works as expected. See the Pen RwxjpqW?editors=1011 by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
GreenSock Posted April 2, 2022 Share Posted April 2, 2022 That's a good catch, @ngc7293. There was an event listener left on in that particular scenario (it'd only happen if you disable() WHILE dragging) but that should be resolved in the upcoming patch which you can preview at https://assets.codepen.io/16327/Observer.min.js See the Pen OJzOZpV?editors=1010 by GreenSock (@GreenSock) on CodePen Better? 1 Link to comment Share on other sites More sharing options...
ngc7293 Posted April 5, 2022 Author Share Posted April 5, 2022 On 4/3/2022 at 5:39 AM, GreenSock said: That's a good catch, @ngc7293. There was an event listener left on in that particular scenario (it'd only happen if you disable() WHILE dragging) but that should be resolved in the upcoming patch which you can preview at https://assets.codepen.io/16327/Observer.min.js Better? That 's great! But when dragging, I want to allow native scrolling in the vertical direction and disable default events in the horizontal direction. What should I do? Link to comment Share on other sites More sharing options...
OSUblake Posted April 5, 2022 Share Posted April 5, 2022 Hi ngc, I'm not exactly sure what you mean here. What exactly are you trying to do? 2 hours ago, ngc7293 said: But when dragging, I want to allow native scrolling in the vertical direction and disable default events in the horizontal direction Link to comment Share on other sites More sharing options...
ngc7293 Posted April 5, 2022 Author Share Posted April 5, 2022 19 minutes ago, OSUblake said: Hi ngc, I'm not exactly sure what you mean here. What exactly are you trying to do? The function I want to implement is similar to the "allownateuchscrolling" property of the Draggable plug-in. Link to comment Share on other sites More sharing options...
OSUblake Posted April 5, 2022 Share Posted April 5, 2022 You can use the touch-action CSS property to control stuff like that, but I'm not sure exactly sure if that's what you're looking for. Link to comment Share on other sites More sharing options...
ngc7293 Posted April 5, 2022 Author Share Posted April 5, 2022 2 hours ago, OSUblake said: You can use the touch-action CSS property to control stuff like that, but I'm not sure exactly sure if that's what you're looking for. I need to set preventdefault to true to ensure that the picture will not be dragged away by the default behavior on the PC, but on the mobile phone, the page cannot scroll because of this setting. I revised the case and hope it can express my problem clearly. Link to comment Share on other sites More sharing options...
OSUblake Posted April 5, 2022 Share Posted April 5, 2022 Like I said, you can use the touch-action property for that, but it's not going to work if you preventDefault. See the Pen WNdMezd by GreenSock (@GreenSock) on CodePen Link to comment Share on other sites More sharing options...
ngc7293 Posted April 5, 2022 Author Share Posted April 5, 2022 Yes, that's my goal, just like Draggable. 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