Jump to content
Search Community

Delete a draggable object

savvi 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

Once you have declared a draggable object is there away to delete it again?

 

The reason I ask is that I have page that works really well controlling multiple tweens as you drag the container. The problem comes if the browser is resized and I get all sorts of odd results.

 

if you hit refresh then it works fine. So my thinking is the easiest way to get around this would be to redelclare everything after a resize. I've done this for the timeline animations but i can't seem to find a way to get rid of the "draggable" once it has been set. There is a "disable" but what I would like to do is completely remove it.

Link to comment
Share on other sites

its a little complicated to produce a demo but essetially what happens after a resize is that the animation is all out of sync which kind of expect. I have no way of resetting the progress.

 

If however you drag on the container a function is called on update and does the following

 

************************   

 

var X = -this.x;
    
 if (X <0 ){
        X = 0    
 }
 animation.tl.progress(X/data.w3);

 

*************************

 

I thought I could trigger this function after resize but it only works if you physically drag on the container.

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