Jump to content
Search Community

Wait for animation to finish before executing next stage of script

amort2000 test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Hi,

 

I've got a button reversing a timeline, then following a link.

 

My trouble is that the link is followed (so exiting the page) before the timeline finishes.

 

What am I doing wrong here? Thanks peeps, function below:

 

function menu_close(e) {
    e.preventDefault();
    let link_destination = this.getAttribute("href");
    tl_mobile_menu.reverse();
    window.location.href = link_destination;
}

Link to comment
Share on other sites

  • Solution

 

Hello @amort2000

 

In general, it is pretty tough to give solid advice without a minimal demo - but I think you'll just need to delay the change of the window.location.href - maybe put it in an onReverseComplete callback - similar to what was shown in the example in the thread linked below.

 

If that doesn't help, a minimal demo of yours would be greatly appreciated.

 


 

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