Page transition animation from overlay menu

Hello,
I would like to create a page transition for when my site visitors switch between pages using my full page overlay menu. Currently, there is a sliding animation added to a hamburger menu icon which brings up the overlay menu but there is no page transition. I would like to have the same animation play in reverse to reveal the new selected page. Can anyone advise me on this?


Here is my public share link: https://preview.webflow.com/preview/the-berg-design?utm_medium=preview_link&utm_source=designer&utm_content=the-berg-design&preview=91c9062ddd3222d634b69dca1276b6da&pageId=5fde6b3c9e715145e8a7b954&mode=preview
(how to access public share link)

Iā€™m looking for this too. Canā€™t find it anywhere. Iā€™ll let you know if I find anything

1 Like

@thebergdesign
@ryang2723

Follow instructions on this page:

Here is reference code:

<!-- Start .onClick Page Transition -->

<script>
function delay (URL) {setTimeout( function() { window.location = URL }, 850 );}
</script> 

<!-- End .onClick delay Transition -->

ā€˜850ā€™ is how many ms you want your transition event to be.

Look at these screenshots for guidance.

You can put code only on certain pages OR on the whole website in project settings.


You need to make an IX2 On Button Click for your transition event. I reccomend staying the same 'xā€™ms you defined in the code for your transition. In this example, my transition sequence is 850ms.
image

Assign the button linkblock or textlinkblock the transition element trigger
image

apply ā€˜javascript:delay(ā€™/page-path/pagrā€™) exactally as instructed in the link above.

Optional - assign id onclick-delay , then you can reference #onclick-day in custom code for other stuff on an as-needed basis.
image

Good luck!!

miek

@miekwave Wow, this looks a little above my pay grade :sweat_smile: Thank you for explaining it so well. Iā€™m going to give it a try and Iā€™ll come back here if something confuses me :white_check_mark:

Thanks for this. All the steps are pretty straight forward. I donā€™t know code at all and itā€™s real easy to impliment. However, mine isnā€™t quite working. It only goes through part of my menu animation and doesnā€™t close the drawer. Thereā€™s probably something in the build preventing this. Back to detective work

@thebergdesign
Practice it in a blank sandbox webflow project before implementing on your main project. This way you can mess arround until you understand how it works.

Thats what I always do, I have a sandbox project just for screwing arround until I learn exactally how things work, before putting it on a main project.

@ryang2723
Can you make a loom.com video or post screenshots of your error?

Hi @miekwave, I just finished with the guide as laid out in the Webflow Blog and itā€™s working pretty well now. Iā€™m missing where I need to implement your screenshots though?

One things Iā€™ve noticed overall is that in the designer, the page links take me to either a 404 page or the about page of the Webflow website itself. Iā€™ve published the site, and it works completely as intended there, with each link taking me to the correct page on my site - do you know why this is happening? I guess itā€™s better that having it the other way around, but Iā€™d like to be sure that it doesnā€™t lead to problems down the line. You can view it if you go to [https://the-berg-design.webflow.io]

Lastly, Iā€™ve also noticed that the animations can run a bit choppy sometimes, it detracts from the quality of the website so Iā€™d prefer if I could guarantee a smoother flow of the animations if possible. Are you aware of any solutions?

Thank you for your continued help, I appreciate it.

1 Like

This is my sandbox project. Trying to experiment and troubleshoot to get things as close as possible and then rebuild it by referencing what Iā€™ve done. I find that when people do a barebones version it doesnā€™t really address some of the complications that may arise. They are usually too simple to account for unforeseen design challenges.

Here is a video of what Iā€™m dealing with

The Published link:
https://test-menu-bar-9dc523e7ea54e0f9026d4c876.webflow.io/

The read only link:
https://preview.webflow.com/preview/test-menu-bar-9dc523e7ea54e0f9026d4c876?utm_medium=preview_link&utm_source=designer&utm_content=test-menu-bar-9dc523e7ea54e0f9026d4c876&preview=8a3c4d25e2c11303280b5099dc491077&mode=preview

Thanks for taking a look, greatly appreciated.

@ryang2723
Thanks for sharing that!

image - assign lose drawerto CLASS in IX2 this will ensure uniformity across all pages.

Does that work?

I would reccomend converting your main menu to a symbol so its easier to apply to all pages.
Define class names and bind them in IX2.

(your designer navigation is a little confusing to me because of certain show/hide/x-y states, if youd explain click classes or sections are masks or not it would help diagnose better)

@thebergdesign

Designer preview mode using delay click
Links will not work with /.onclickDelay in designer view because your using relative link references, so it references {currentdomain}.com/{yourpage} within designer. So if you click it within webflow designer, it points to webflow.com/{yourpage}, if you click it from .io it will point to .io/{yourpage} and so forth.

SEO implications
Crawlers do not recognize onClick delay links. If you want those links crawled on the page, be sure to include them in the footer or some other content section as natural links.

Croppy Animation:
Please be more specific about what you mean by choppy animations.

https://the-berg-design.webflow.io/ Menu clicks pages seem to work for me and seamlessly transition. Though, there is an awkward load time between some pages, that can be addressed with a loading icon.

So I followed your steps above AND made my nav bar and menu drawer symbols and the nav animation works on both pages now. I for sure donā€™t understand why lol. Is it because I made them symbols OR is because I assigned the class to my Close Drawer? All part of the learning process I guess but itā€™s def hard to know why things work the way they do when you donā€™t fully understand the code concept behind it.

However, the page transition from menu to page link still does not work.
https://test-menu-bar-9dc523e7ea54e0f9026d4c876.webflow.io/

There is also one other problem I am realizing. In order for the Delay Code to work you need to add the slug to the JS in the URL field. Your home page does not have a slug. So Work in my menu would essentially go back to my Home page but there is no way to enter a non-existing slug.

As far as the design navigation, you can chalk that up to I just donā€™t know what Iā€™m doing at this point. And I guess I donā€™t know fully what you mean by ā€œclick classes or sections are masksā€. Sorry this must be frustrating for you.

In my IX2:
ā€¢Drawer Open:
I have hide show for the close button (X) because I donā€™t want it to be visible in the initial state and I donā€™t want it to interfere with the three dots in any way. I think this may have been an artifact from when I had the close-menu-wrapper and dot-menu-wrapper as two different things, i.e. there was no menu-button-wrapper and both were contained in the Menu Wrapper as their own buttons essentially. This proved problematic in setting up the interactions and once I contained them in the menu-button-wrapper and assigned interactions only to that element (instead of to the dot and close buttons individually), everything work fine. Except for the problem we just remedied.

Iā€™m basing this on some tutorials Iā€™ve watched where the hamburger animates to an X but the elements are contained in a Div that triggers the animation. Iā€™ve tried to recreate this but I have dots instead of lines so the animation isnā€™t as straight forward. (dots>X instead of lines>X)

I hope this makes sense, really sorry Iā€™m not better versed in this. A lot of trial and error at this point.

Hi @miekwave thank you again for your reply.

Designer preview mode
Understood :white_check_mark:

SEO implications
Understood :white_check_mark:

Croppy Animation
Here is a quick video showing what I mean. In particular, the ā€˜Portfolioā€™ page looks really ugly during loading.Screen+Recording+2021-03-12+at+02.10.04+PM-min

assign homepage java with ā€˜/ā€™ or ā€œ/ā€ will trigger onclick delay t homepage.

Remember everytime you use onclick delay for transition, make a natural link somewhere else on the page such as the footer

Choppy animation is subject to opinion. As I mentioned earlier, it looks fine on my device, and it looks fine to me in yor screenshot, but thats my opinion. I would suggest experiementing with tweening curves, animation times, and offsets. such as ease-in vs ease-out or sine or other curves.

As far as portfolio loadingā€¦ i reccomend creating a loading asset, for example one of these

and you can set up special onclickdelay and pageload init and page load complete rules for the loading icon

that would make it less ugly

1 Like

@miekwave Thank you for this, for some reason, the animations have mostly all smoothened out - I think I had too many tabs open on my system so it was running at max capacity. The portfolio page still loads too slowly so I will follow your suggestion of created a loading asset.

I have gone further and tried to add the page transition to the logo button at the top of the page, and the footer links to each page too, however the method you linked to at the top isnā€™t working for these elements. I think it has something to do with adding the code `javascript:delay(ā€˜/ā€™) to these elements - it doesnā€™t work the same way as for the on-page elements. Do you have any suggestions?

Thank you

This worked well, and smooth and nice.
I have one big problem - When using ā€œbackā€ in a browser, the previous page gets shown with the outro animation Ā» in my case a fully blank page.

Do you happen to know of a way to (re)trigger something so that this works.
Ideally you want the ā€œbackā€ command to really go back and (re-)open the page - including the outro-animation on the current page and the reloading/intro animation for the page in history youā€™re navigating towards.

I found a page where this works well: https://www.engineeredfloors.com/
But I have no idea how they did that (not Webflow i think)