instantclick icon indicating copy to clipboard operation
instantclick copied to clipboard

Stop menu from opening when back button is clicked

Open devemmastone opened this issue 6 years ago • 0 comments

I just have a minor issue and that is when I click on my full screen menu and click on one of the menu items and then click the back button the full screen menu is open again? I know it has something to do with it remembering the last state the page was at before I clicked on an item.

Is there a way to avoid that when using InstantClick?

The script I am using is this one:

/* Open when someone clicks on the span element */
function openNav() {
  document.getElementById("myNav").style.width = "100%";
}

/* Close when someone clicks on the "x" symbol inside the overlay */
function closeNav() {
  document.getElementById("myNav").style.width = "0%";
}

Thanks in advance.

devemmastone avatar Nov 01 '19 20:11 devemmastone