Make Twitter Bootstrap navbar link active

前端 未结 9 1104
情深已故
情深已故 2020-11-30 21:33

What\'s the standard way to make the active link in a Twitter Bootstrap navbar bolded? It\'s clear that a link gains the active appearance by gaining the \"active\" class. F

9条回答
  •  孤独总比滥情好
    2020-11-30 22:10

    You need to ensure that you set the active class as part of the request response (as the page loads) and not before ie when the user clicks a link to request a different page.

    First you need to determine which navlink should be set as active and then add the active class to the

  • . The code would look something like this

    Tested by asker:

    HTML within php file

    Call a php function inline within the

  • markup passing in the links destination request uri

    
    

    PHP function

    The php function simple needs to compare the passed in request uri and if it matches the current page being rendered output active class

    
    

提交回复
热议问题