Streaming live at 10am (PST)

Page transitions. Javascript delay + history.back?


#1

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!


#2

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


#3

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://forum.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


#4

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()

#5

Great, thank you very much, works a charm!


#6

Good, next time please cite your sources.