Like the above site navigation, when I click on the link will highlight the label, when I click on other pages will jump to the corresponding page, and the current page corresponding to the navigation label will be highlighted, what is the general design plan? What are the good, elegant solutions? Solution.
The solution I personally think of is:
1, in the Windows load time to traverse the URL of these tags, if and the current page URL of the same page is highlighted;
2, using a cookie to store the current click of the navigation index, and then go to the current page to read the index value, the index value tag tags added highlighting;
Feel that these two methods are a bit unreliable, seeking a better idea.
Reply content:
Like the above site navigation, when I click on the link will highlight the label, when I click on other pages will jump to the corresponding page, and the current page corresponding to the navigation label will be highlighted, what is the general design plan? What are the good, elegant solutions? Solution.
The solution I personally think of is:
1, in the Windows load time to traverse the URL of these tags, if and the current page URL of the same page is highlighted;
2, using a cookie to store the current click of the navigation index, and then go to the current page to read the index value, the index value tag tags added highlighting;
Feel that these two methods are a bit unreliable, seeking a better idea.
Javascript
You can use the property of element A and the URL of the href
page to determine
You can also add a custom data property to each element, such as a data-pattern
regular match on the inside
jsfiddle:https://jsfiddle.net/bd4g5f2h/
Feel no need for this, originally on 35 pages. You create a highlighted class. Then you can set a highlighted navigation for each page. If you're using a template engine. This step can be done with a template engine. If you are using a single page application, this situation is to consider using JS, or to judge the things behind the #