A
A
Artemmmm132020-09-28 16:40:58
JavaScript
Artemmmm13, 2020-09-28 16:40:58

How to track an event when clicking the "Back" button?

The fact is that my side menu on mobile devices opens by clicking on the burger menu. In the sidebar itself, there are links to other pages, and if you follow any link, and then click the browser button (back), then the side menu remains open, but it shouldn’t be. Tried to close the side menu through "onbeforeunload", "popstate" events but it doesn't work.
(PS Sidebar is opened by adding a class and simple css animation). I was looking for an event in the documentation but did not find a suitable one, maybe someone knows how to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question