dieulot / instantclick

InstantClick makes following links in your website instant.
instantclick.io
MIT License
5.51k stars 246 forks source link

Stop menu from opening when back button is clicked #172

Open devemmastone opened 4 years ago

devemmastone commented 4 years ago

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.