Jump to content
Search Community

Moving element left and right on scroll

amit95 test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

I have a simple section which contains extra large text. Two of these sections exist, one which is right aligned, and one which is left aligned.

 

On scroll, I want the right aligned header to move left (which works in my demo, so all good here).

 

The left aligned text however, I want moving right on scroll. This in my demo however doesn't work.

 

The xPercent is negative for the right aligned header, which allows it to move left. By that logic, I've got a positive xPercent value for the left header, however, it doesn't make any movements?

 

See the Pen XWqyYNr by amit_rai95 (@amit_rai95) on CodePen

Link to comment
Share on other sites

  • Solution

Hi,

 

I think this is related to the positioning of the element sine you're using a span without a position property.

 

This seems to solve it:

<span class="xlHeader__header d-inline-block">Goes right</span>

 

Let us know if you need anything else.

 

Happy Tweening!

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