The next segmentfault in the user Settings page on the right of the Li after clicking Refresh how to Remember?

Source: Internet
Author: User

, I clicked the work education experience, the page refreshed, at this time the activation of the project became a work education experience, how is this achieved?

Is the backstage passed to the foreground which Li was activated? Or is there another way to implement it?

Reply content:

, I clicked the work education experience, the page refreshed, at this time the activation of the project became a work education experience, how is this achieved?

Is the backstage passed to the foreground which Li was activated? Or is there another way to implement it?

Judging the current page based on URL incoming parameters $tab


  <>
   
    class="current"
   
   >xxx
   <>
   
     class="current"
    
   >xxx
   
   
  
   

First of all, thank you for inviting me to answer. Then your so-called activation, in fact, is to give li a class="current" property, as to how to judge, this is more simple.

Segmentfault this should be in the back-end judgment, this WordPress and other programs in the subject is written, the idea should be the same as you, each judge whether it is the current page, is the addition, not the addition.

But recently wrote the topic of static blog, found that they have such a train of thought. The program has a extends and block function that can define the parent template and the replication item, for example, I base.html define the


  
   
    
   你好我是首页
   
    
     
    你好我是用户页
    
     
      
     你好我是文章页
    
     
   
    
  
   

And then I wrote this in the user page.

{% extends 'base.html' %} {# 表示把base.html继承了过来 #}{% block user %} class="current"{% endblock %} {#表示给上面定义的一个可以复写项赋值#}

So eventually my user page will show this effect.

  • 你好我是首页
  • 你好我是用户页
  • 你好我是文章页
  • This can also achieve the goal. Of course you can also choose to judge in the front, to each li add a corresponding class , the best and URL the call name consistent, and then based on URL the value of the direct assignment to the corresponding object is made.

    In general, if you don't want to give

  • Add a separate logo, it can only be in the background/front-end a judge, if you add a separate logo can be a little faster, the back end/front end is not limited.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.