Jump to content
GreenSock

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

Gsap only resizes content as soon as I stop resizing my browser

Recommended Posts

I have a centered element on my page and when I resize my browser, the element only moves back to the center as soon as I stop resizing the window. Fonts with viewport-related sizes are changing dynamically.

I think this is caused by the pin-spacer over my whole element - is that possible? I noticed that it sets itself a fixed width every time I stop resizing.

Changing

pinSpacing: true,

to

pinSpacing: false,

does not solve the problem.

 

Is there maybe a way to let the element check the browsers width while resizing the window too?

 

Thanks! :) 

Link to comment
Share on other sites

Thanks,

this worked for me:

window.addEventListener('resize', function(event){
ScrollTrigger.refresh();
});

 

 

Link to comment
Share on other sites

Just echoing this

 

1 hour ago, OSUblake said:

There's really no need to recalculate stuff until the browser size has settled.

 

Listening to the resize event and recalculating during resize is a pointless performance drain in most cases. It's a lot of work for the browser and most people don't even look at the content while they're resizing. It's a really small micro detail that devs obsess over - but it's not really of concern to the average user.

  • Like 3
Link to comment
Share on other sites

Yes that is definitely true, its just for a very specific case :) 

 

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