Jump to content
Search Community

Draggable - snap returning value not working

bulbo test
Moderator Tag

Go to solution Solved by bulbo,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello!
 
I have a little problem with Draggable Plugin and the snap option.

draggable = Draggable.create(__that.$slideshow, {type:"x", edgeResistance:.5, throwProps:true, lockAxis : true, bounds:__that.$bounds
                    , snap: {
                        x: function(_x) {
                            var
                            newX = (_x / __that.totalFlowWidth) * __that.totalFlowWidth;
                            return newX;
                        },
                    }
                });

In the above example, totalFlowWidth represents the total width of my container.

 

The problem is that the value are correct but the snap tween is not launched in the return.

When i put a number instead of variable newX, it works. When i switch to newX (which return a number value), nothing happens.

 

It's very weird.

 

Need some help.

 

Thx :)

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...