Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Julia

TimelineLite does not work inside jQuery's scroll method

Recommended Posts

Hi. My animation does not work inside Jquery's scroll method when I check if ScrollTop() is greater then 210

 

$(window).scroll(function() {
if ($(this).scrollTop() > 210) {
console.log("scrolling");
console.log($(this).scrollTop());
let tlSecond = new TimelineLite();
tlSecond.from("#fifth_load_group", 3, {
marginTop: "50px",
ease: Power4.easeOut,
opacity: 0
});
}
});
Link to comment
Share on other sites

Hi @Julia,

 

It's calling it ... but just calling it hundreds of times! Have a look here to see one way of making sure it's called once,

 

See the Pen Pvwqpe by sgorneau (@sgorneau) on CodePen

 

Happy tweening!

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