-1

I'm using materialize to customize my webpage. I have a sidenav with collapsible li's. Lets say the li's are fruit vegetables and cheeses. when i click on any of these, for instance vegetables, it uncollapses to carrots, broccoli and peas. when i click on broccoli, the broccoli page associated loads fine. The problem is the broccoli li on the sidenav no longer is active, because the page refreshes to a new url. also the vegetables li is no longer active. How do I make both of these stay active after i refresh the page? I went on materialize website (which works exactly how id like mine to) and I have the same js as them so I don't understand why mine isn't working. Thanks.

  • 1
    Without seeing code, nobody can really help. Sounds like you need a get request though to keep your data, or put into localStorage. Or code it so that there is no refresh. – shadow2020 Jun 03 '19 at 21:59

1 Answers1

0

With no code, it's hard to say.. First thought would be 1) Do you really need to refresh? Maybe you could redraw instead? or 2) You could pass in some info in the url when you refresh to indicated what should be shown. Something like "http://myurl.com#someInfo". Alternatively you could use a ?. What is the meaning of # in URL and how can i use that?

Sloan Tash
  • 36
  • 4