Retaining Accordion’s Open or Closed state Upon Using Browser’s Back Button
-
Is there a way for the browser to remember which accordion items were open or closed upon using the back button? I have a page featuring several nested accordions that serve as a file catalog, and users can click links in the accordions to view the files on a new page, but I would like my users to be able to use the back button to browse other links without having to expand all the accordions each time they go back.
I am thinking this can be done using local storage, but I am not knowledgeable enough regarding java script to understand how to implement this.
On another note, this functionality seems to work fine on Firefox, but not on any other browser I’ve tested. (Chrome, Edge) I also am having trouble with HTML anchors opening accordion items when navigating to them from another page.
For any help or information you could provide, I would be eternally grateful. Thank you!
EDIT: On another note, it seems like the accordions will stay open in Chrome if the users are not logged in on my website, which is absolutely confusing. I have no idea what is causing this, but it is something I thought you would like to know.
- The topic ‘Retaining Accordion’s Open or Closed state Upon Using Browser’s Back Button’ is closed to new replies.