Reload page with Back Button. Not reloading graphs correctly

I don’t know how to write JS but I’m working on a site and I need to reload animated graphs when press on the browser back button.
I found this script below that kind of works but before it reloads the pages it scrolls top in a not fluid way and I’d like to avoid that. Ideally I think I’d love a fade out effect.

I’m using WordPress.

window.onpopstate = function(event) { 
    window.location.reload();
};

Any help would be great!
Thanks

Read more here: Reload page with Back Button. Not reloading graphs correctly

Leave a Reply

Your email address will not be published. Required fields are marked *