Jump to content
Search Community
Mustana test
Moderator Tag

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

@Mustana, good to see you hear in forums as well :)

I noticed that you are expecting to use `e` (i.e. event object) inside the `onDragEnd` and `onDrag` callbacks but as per the documentation, you need to reference the `Draggable` object by using `this` keyword.

 

So these lines:

...
if (e.x >= 400) {
...

and 

...
var clipProp = (e.x - 10) + 'px';
...

should be changed into:

...
if (this.x >= 400) {
...

and 

...
var clipProp = (this.x - 10) + 'px';
...

The event object that you were trying to access before is the one that is made available by browsers but the properties it carries, varies between browsers. So Google Chrome has the `x` and `y` exposed and your code seemed to work just fine but the cross-browser way would be to access the Draggable object by using `this` keyword and then access `x` or any other property through it.

I hope this solves your problem.

  • Like 4
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...