After I click "Work and Education Experience", the page is refreshed. The activated project becomes "Work and Education Experience". How does this happen? Which li is sent from the background to the foreground to be activated? Or other implementation methods?
After I click "Work and Education Experience", the page is refreshed. The activated project becomes "Work and Education Experience". How does this happen?
Which li is sent from the background to the foreground to be activated? Or other implementation methods?
Reply content:
After I click "Work and Education Experience", the page is refreshed. The activated project becomes "Work and Education Experience". How does this happen?
Which li is sent from the background to the foreground to be activated? Or other implementation methods?
Input parameters based on URL$tabJudge current page
class="current"
>xxx
class="current"
>xxx
First, thank you for inviting me to answer. Then your so-called activation is actuallyliAssignedclass="current"Attribute. This is easier to judge.
SegmentFault should be determined at the backend. The theme of this WordPress program is written. The idea should be the same as that of your program. Each of them will judge whether it is the current page, no.
However, I recently wrote a static blog topic and found that they have such an idea. The program hasextendsAndblockFunction, which can define the parent template and rewrite items. For examplebase.htmlThis defines
Hello, I am the homepage.
Hello, I'm a user page.
Hello, I am an article page.
Then I write this in the user page
{% Extends 'base.html '% }{# inherit inherits base.html #}{ % block user %} class = "current" {% endblock % }{# indicates that the preceding definition can be rewrite item assignment #}
In the end, my user page will display this effect.
Hello, I am the homepage.Hello, I'm a user page.Hello, I am an article page.
This can also achieve the goal. Of course, you can also choose to judge at the front end to give eachliAdd a correspondingclass, Best andURLThe same call name, and then accordingURLThe value is directly assigned to the corresponding object.
In general, if you don't want
If you add a separate logo, you can only judge the backend/front-end one by one. If you add a separate logo, you can do it quickly. The backend/front-end is not limited.