Jump to content
Search Community

Horizontal scroll resize

Umberto test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

  • Umberto changed the title to Horizontal scroll resize

 

Hello Umberto,

 

You didn't change your CSS styling in any way, for your layout to adapt to the different behaviour below 800px, so your sections in the horizontal container will still be aligned one beside each other and thus most of them will still be 'hidden' our of view to the right, of course.

 

https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_media_queries/Using_media_queries


Here's an example;
Please keep in mind though, this is just a quick and dirty fork of your pen, to give you an idea, and not intended to be an ideal fit for any case you may encounter, as this isn't really GSAP related but actually more general CSS layout handling.

I hope it will help anyway.

See the Pen jOQBwra by akapowl (@akapowl) on CodePen


 

  • Like 2
Link to comment
Share on other sites

  • 8 months later...

Hi,
Sorry if I'm revisiting an old post of mine.

I tried inserting images in the section to have the parallax effect.
In the first section everything is ok, but from the second onwards a space is created between the images.

 

See the Pen abxdwgN by umberto (@umberto) on CodePen

 

Can I get some help?
Thank you

Link to comment
Share on other sites

I've restructured your pen, mainly HTML and CSS what I would do is create an <img> element that is bigger than the current container it is in and then move the element minus on the x axis (I think you want it to move that way right)

 

Always turn on makers so that you can see what it is doing. I've set your start and end marks to be left center and end right center, but be sure to tweak them to your liking. Still the images need to be bigger then how much you want to move them, that is not setup perfectly here. I've also moved the <img> instead of the container. Hope it helps and happy tweening! 

 

See the Pen MWRKvry?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

  • Like 1
Link to comment
Share on other sites

This work is perfect and I'm working on it.

I found a new Horizolthal scroll, where I implemented SrollSmoother, but I have a problem when I widen and narrow the layout:

 

In the first example, without SrollSmoother everything works

 

See the Pen QWPNGLb by umberto (@umberto) on CodePen

 

In the second example, with SrollSmoother, the image pops out of the container

 

See the Pen xxeVRxP by umberto (@umberto) on CodePen

 

 

 

The problem is that SrollSmoother doesn't refresh

can you help me?

Screenshot 2024-03-10 alle 14.42.33.png

Link to comment
Share on other sites

I don't see any issues in either or the two demo's. But The blue is from the background of the image container right. Just remove all JS logic and try making the image bigger with CSS, so that is always is larger then the container it is in. 

Link to comment
Share on other sites

No normal visitor is resizing the browser halfway through browsing a site.  That said as soon as you stop resizing ScrollTrigger refreshes it self and everything jumps back to normal. At least I see no issues on my browser with multiple different screen sizes. 

Link to comment
Share on other sites

Thanks for the reply.

 

I tried various browsers and resizing the layout, the space between the image and the section remains and Scrolltrigger does not refresh. To get everything back to normal I have to refresh the browser.

 

Just to clarify, is the problem Scrollmother not updating when I resize?

 

 Thanks for the help

Link to comment
Share on other sites

Hi,

 

I've been fiddling with this demo for a bit and resized the window to a bunch of different width/height combinations and I don't see the blue parts anywhere, maybe I'm missing something here but this seems to work as expected 🤷‍♂️

 

Happy Tweening!

Link to comment
Share on other sites

8 hours ago, GreenSock said:

I see what you mean, @Umberto and I'm looking into it. I'll post back when I have answers/suggestions, but it may take some time. 

Of course, work calmly, I'm not in a hurry.
The important thing is always to be able to solve the problem

Thank you very much, I await with serenity

Link to comment
Share on other sites

I figured it out. It has to do with the order that things get refreshed. ScrollSmoother forces ScrollTrigger.sort() to get called which orders things by the ScrollTrigger's start value which is a decimal for any ScrollTriggers with containerAnimations. So all you really need to do to fix it in the current version is to explicitly set a lower refreshPriority on the containerAnimation ones: 

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

 

(I set refreshPriority: -1)

 

It should be resolved in the next release which you can preview at: 

https://assets.codepen.io/16327/ScrollTrigger.min.js

 

(you may need to clear your cache)

 

Does that clear things up for you? 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

You did an excellent job, it's what I wanted

 

One last question:
with the new version of ScrollTriggrer, I can eliminate refreshPriority: -1, and add invalidateOnRefresh: true?
Or should I leave everything as it is?

 

THANKS

Link to comment
Share on other sites

57 minutes ago, Umberto said:

One last question:
with the new version of ScrollTriggrer, I can eliminate refreshPriority: -1, and add invalidateOnRefresh: true?
Or should I leave everything as it is?

It won't hurt anything to leave that in there, and it shouldn't be necessary in future versions. I'd just leave it.

 

I don't think invalidateOnRefresh: true was ever needed in your animation because you don't have any dynamic tweening values anyway. 

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