librelist archives

« back to archive

How to get Twitter-Bootstrap navigation to show active link?

How to get Twitter-Bootstrap navigation to show active link?

From:
Eladio Caritos
Date:
2012-10-16 @ 00:56
Trying to implement Twitter Bootstrap but unsure on how to change a class
for the "li" element based on the url using the jinja2 templating system?

            <ul class="nav">
                <li class="active"><a href="{{ url_for('home')
}}">Home</a></li>
                <li><a href="{{ url_for('contact') }}">Contact</a></li>
            </ul>

Found this solution for rails:

http://stackoverflow.com/questions/9879169/how-to-get-twitter-bootstrap-navigation-to-show-active-link

-- 
Eladio Caritos
129 Main Street #268
Stony Brook, NY 11790
631-706-4213
http://caritos.com

Re: [flask] How to get Twitter-Bootstrap navigation to show active link?

From:
Sean Davis
Date:
2012-10-16 @ 01:16
On Mon, Oct 15, 2012 at 8:56 PM, Eladio Caritos <eladio@caritos.com> wrote:

> Trying to implement Twitter Bootstrap but unsure on how to change a class
> for the "li" element based on the url using the jinja2 templating system?
>
>             <ul class="nav">
>                 <li class="active"><a href="{{ url_for('home')
> }}">Home</a></li>
>                 <li><a href="{{ url_for('contact') }}">Contact</a></li>
>             </ul>
>
> Found this solution for rails:
> 
http://stackoverflow.com/questions/9879169/how-to-get-twitter-bootstrap-navigation-to-show-active-link
>
>
I asked this question a couple of weeks ago and was pointed to this:


http://flask.pocoo.org/mailinglist/archive/2011/7/29/styling-the-current-navigation-element/

Hope that helps.

Sean

Re: [flask] How to get Twitter-Bootstrap navigation to show active link?

From:
Anthony Ford
Date:
2012-10-16 @ 03:19
Here's my solution:
https://github.com/arcc/caratracker/blob/master/tracker/templates/macros.html#L156

Its bundled within a macro, but should showcase the idea.

Anthony Ford,
KF5IBN,
Research Assistant,
Center for Advanced Radio Astronomy,
University of Texas at Brownsville
ford.anthonyj@gmail.com



On Mon, Oct 15, 2012 at 8:16 PM, Sean Davis <sdavis2@mail.nih.gov> wrote:

>
>
> On Mon, Oct 15, 2012 at 8:56 PM, Eladio Caritos <eladio@caritos.com>wrote:
>
>> Trying to implement Twitter Bootstrap but unsure on how to change a class
>> for the "li" element based on the url using the jinja2 templating system?
>>
>>             <ul class="nav">
>>                 <li class="active"><a href="{{ url_for('home')
>> }}">Home</a></li>
>>                 <li><a href="{{ url_for('contact') }}">Contact</a></li>
>>             </ul>
>>
>> Found this solution for rails:
>> 
http://stackoverflow.com/questions/9879169/how-to-get-twitter-bootstrap-navigation-to-show-active-link
>>
>>
> I asked this question a couple of weeks ago and was pointed to this:
>
>
> 
http://flask.pocoo.org/mailinglist/archive/2011/7/29/styling-the-current-navigation-element/
>
> Hope that helps.
>
> Sean
>
>