Jump to content
Search Community

About the Observer plugin

ngc7293 test
Moderator Tag

Recommended Posts

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

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? 

  • Like 1
Link to comment
Share on other sites

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

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

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.

image.png.abccef23840b490a07b1cdb5f7ee0cbe.png

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...