Streaming live at 10am (PST)

Page transitions. Javascript delay + history.back?

Hi :wave:

I’m using page transitions, and was wondering if there’s a way to combine 'javascript:delay('URL') with 'javascript:history.back(); ?

I’d like to create an ‘about’ page with a back button, that plays a page transition before leaving.

Appreciate the help!

there is no such function in JavaScript.

Duplicate of

Time delay on current page before load next page
Delay link click - not working
Delay page transition for animation to complete

Hi Sam, appreciate the swift response.

Maybe I miss quoted. The delay(‘URL’) technique was taken directly from this webflow blog post. I’ve implemented it effectively across the site already.

https://webflow.com/blog/how-to-build-page-transitions-in-webflow

The history.back technique was taken from a previous post of yours.

https://discourse.webflow.com/t/how-to-setup-back-button/34944

I want to know if there’s a way to combine both into a single command I can paste into the link ‘URL’ box?

I know this doesn’t work, but something like this?

26

Many thanks

That makes more sense now.

In that case step 1 can be changed to the following

<script>
function delayBack() {
    setTimeout( function() { history.back(1); }, 850 );
}
</script>

Then you’ll call via the link this way

`javascript:delayBack()
1 Like

Great, thank you very much, works a charm!

Good, next time please cite your sources.

Hallo Sam, please, is possible to apply delay to browser back button? It is because of the same reason like Ewan wrote, but I wouldn’t want to create an extra back button. Thank you for help!