Jump to content
Search Community

Scale effect does not resize DOM element

lmschreiber test
Moderator Tag

Recommended Posts

57 minutes ago, PointC said:

In fact, GS recently released ScrollTrigger. It's much more intuitive and feature packed than ScrollMagic IMHO.

I heartily endorse @PointC's endorsement of ScrollTrigger ;)

 

1 hour ago, lmschreiber said:

Does anybody know, why the DOM element is not resized?

It kinda sounds like you're expecting the DOM element itself to alter its height/width - is that correct? Keep in mind that when you "scale" an element, that simply applies a transform and transforms never affect DOM reflow. That's what makes them so performant/fast. And that behavior has nothing to do with GSAP - that's how browsers work. If you want the element itself to resize and cause reflow (which I generally discourage), you'd need to animate the "width" and "height" properties of the element instead of the "scale" but that makes it a lot more complex to deal with pinning. It's possible, but tricky.

 

Here's your demo with ScrollTrigger: 

See the Pen acf0d29d74c0abac152d1e90dc877f86?editors=0010 by GreenSock (@GreenSock) on CodePen

 

I think you'll find it simpler to work with, and it uses less kb than ScrollMagic too. Way more features as well.  

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