Jump to content
Search Community

Start and End calculation is not correct even after scrollTrigger.refresh()

MIR-MEDIA
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

MIR-MEDIA
Posted

I dug into old topics and found some solutions but none of them worked or maybe I couldn't correctly try them so forgive me if I'm repeating an old question. I just want to implement a simple sticky inside its parent and though the element sticks to the correct position, the    start    seems wrong. The main problem is the     end     because the sticky element stops before it reaches the bottom of its parent.

 

 

See the Pen WbNbqam by arishojaei (@arishojaei) on CodePen.

  • Solution
mvaneijgen
Posted

Hi @MIR-MEDIA welcome to the forum and thanks for being a club member 🎉

 

Currently you've set your end trigger to be the center of the browser, but you want it to be the bottom of the sticky element. Eg you want to write some logic to get that pixel value of that element and use that as the end trigger. 

 

I've updated your pen and I’ve placed some comments in your JS to better explain things, please be sure to read through them! Hope it helps and happy tweening! 

 

See the Pen VYwLYGV by mvaneijgen (@mvaneijgen) on CodePen.

  • Like 2

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