Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Demorus

remove values when the window resizes and restart tween?

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

I have two timelines that have two versions set up differently depending on the screensize using  $(window).width(). The issue is that it gets messy so I need to reset all tweens and make them start again. Somehow my following code doesnt work. 
 
Any idea why?
 
$(window).resize(function(){
sed.invalidate();sed.restart(); 
part.invalidate();part.restart();
});
 
this seems to be closer to what im looking for but it doest remove some of the old values:
 
$(window).resize(function(){
        sed.reverse();sed.reverse();
part.play();
});
 

 

Link to comment
Share on other sites

We'd be happy to help - would you mind providing a simple codepen example of the problem? A reduced test case helps us quickly identify what's going on in your particular scenario. It's just very tough to troubleshoot blind. 

 

http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

  • Like 1
Link to comment
Share on other sites

Would love to have done that, problem is the code and css is so huge.

 

Is there any general way to remove all the inline styles on the div like $('div *').removeAttr('style'); and then replay the timelime after the styles have been removed?

Link to comment
Share on other sites

Hi Demorus  :)

 

as Jack mentioned previously , pls make a Reduced Codepen demo available .

 

but for now you can try something like this ( easiest way ) : 

See the Pen GgbzOV by MAW (@MAW) on CodePen

 

and for clear div's style you can use clearProps property , and maybe this post can help you : 

 

http://greensock.com/forums/topic/11320-clearprops-of-timeline/

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