Jump to content
Search Community

remove values when the window resizes and restart tween?

Demorus 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

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?
this seems to be closer to what im looking for but it doest remove some of the old values:


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 : 



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