I’m using the menu on a tumblr blog for filtering tags.
Is it possible for the last opened div to stay open on page reload?
Could the selected link (tag) be highlighted on the page?
For example: the user clicks and opens the div “material” and clicks on the tag “wood” – on the new page (all images tagged wood) the div “material” is still open and “wood” is highlighted (bold, underlined etc.)
I still wonder how to “remember” the last opened tab of the accordion after reloading the page? I was testing some script with local storage, but it doesn’t seem to work.
So how do you actually store the active item, and what is the + in front of localStorage supposed to do? BTW, are you now using jQueryUI instead of a that flex accordion?
Still using the the flex according. Just looking for ways to keep the last state open of that accordion. Don’t really know, which direction to go. Read something about localstorage or cookies. Is it possible to combine the flex accordion with jquery for keeping the state?
Here is the last codepen of the menu
There’s no attempt to use the local storage in that pen, so I can hardly help you debug your code. From the code you posted above, I can only suggest to remove that + in front of localStorage.getItem('accordion-active'). Also, what does the console say?
You don’t necessarily need jQuery for this; it’s just writing a variable to the local storage really. But since you’re using it anyway, here you go…