*EDIT this seems to happen on all links using the back button. Won’t load the load trigger, added the share link here: https://preview.webflow.com/preview/esoteric-designs?preview=340d820b94f21b02c40a8adb8eebe26e *
Hi everyone
I have a problem with my interactions when you hit the back button on the browser.
At the loading of a page I have an interaction where everything in the fades in from 0% opacity.
If you go to a normal link back the animation works right but if you go back to an anchor link it won’t trigger the animation.
You can see an example here: http://esoteric-designs.webflow.io/design#projects
Just click on any of the projects then click the browser back button on a Mac using Safari or Firefox and it will come to a blank page.
I found someone who wrote some JS to have it go back two clicks but this doesn’t work for me because I think they assigned it to a button on the page with a class (.back-button).
Here is that code:
<script type="text/javascript">
$(".back-button").click(function(e) {
e.preventDefault(); // This will prevent the default link behavior
if(window.location.hash) { // This checks to see if there is a "#" in the current url
window.history.go(-2); // If so, this will navigate the browser back by 2 pages
} else {
window.history.go(-1); // If not, this will only navigate back by 1 page
}
});
</script>
Is there something I can change in that code to make it work or is there another workaround people can think of?
Thanks,
-Justin-