I have 6 different applications represented by <div>
elements. Each <div>
contains a menu with child menus in the form of unordered lists, each containing an <img>
and <p>
tag.
To navigate between these elements, I've added a back button which will store the history of visited elements using unique IDs.
An array called pageHistory is used to keep track of all the elements visited:
var pageHistory = { "History": [] };
Whenever a <div>
, menu, or child menu is clicked, it is added to the pageHistory array like this: pageHistory.History.push(menu);
While this functionality works correctly, there are some issues when navigating back from one <div>
to another. The CSS styling for the child menu from the previous selection remains applied to the new selection, and the selected menu is not highlighted when clicking the back button.
The goal is to maintain the individual CSS styles for each element and ensure that the selected menu and child menu are highlighted properly when using the back button.