Jump to content
Search Community

How to stop Horizontal Bar

Sphinx test
Moderator Tag

Go to solution Solved by Jonathan,

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 am sure this question has been asked before but I don't know exactly how to phrase my issue. A problem I am having right now is that when I rotate an image around 360 degrees, or when I scale it up, it sometimes goes beyond my viewport or current screen width. When that happens the horizontal bar stretches before rebounding back to the start of the animation (when it's on repeat) or disappearing when I scroll. 

 

How can I stop that from happening.

 

I like the scaling effect, but would like it to scale within the current viewport or div.

Link to comment
Share on other sites

Thank you for the codepen example, much better. :D

 

When you say the "horizontal bar stretches before rebounding back" ..

 

Is the horizontal bar the one with the background image? If so i do not see it stretch, but scale out.

 

Or do you mean the browser horizontal scrollbar? That i do see growing due to the element scaling increasing the document width and height.

 

For that you can add the CSS property overflow:hidden on the body tag or on your main containing element.

 

See the Pen PGkBPp by jonathan (@jonathan) on CodePen


 

body {
   overflow:hidden;
}

Does that help?

 

:)

Link to comment
Share on other sites

Or do you mean the browser horizontal scrollbar? That i do see growing due to the element scaling increasing the document width and height.

 

 

YES that's the one! 

 

It did solve the problem ! But created a new problem that prevented me from scrolling past that first div. I put overflow-x and that fixed the problem: 

See the Pen kkPEJd by eternal_wanderer (@eternal_wanderer) on CodePen

 but now the rotation scale overflows into the next div, is there a way to stop it from overflowing into the next div as well. I'm writing two different versions of the code, and one of my versions is rotation and the other is scale. The one I linked I think is the scale version so sometimes I mix the two up when writing here, but have the same problem in either version.

 

Will overflow-x prevent me from using horizontal parallax?

Link to comment
Share on other sites

  • Solution

overflow-x shouldn't prevent horizontal parallax from working. But keep in mind that overflow-x and overflow-y are not fully standard, so even though they are supported, you might have buggy behavior due to those CSS properties being just a working draft of the CSS spec. But you could play it safe and just use overflow-hidden to make sure no scrollbars display regardless.

 

You would need to adjust your other div tag containers so they have a higher z-index. And bring the other div container that is being overlapped on to its own rendering layer so it can create a new stacking context and be above the red scaled div.

 

But I don't have time right now since I would have to add and adjust your html markup and CSS. I will have to wait until I have more time since that is more of a CSS and HTML question of layout and positioning, but not really about the GSAP API. So I have to wait until I have done free time to debug your codepen ;)

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