More information about the Underscore mailing list

[_] php - extracting info from a url to set state of nav

mike karthauser mikek at brightstorm.co.uk
Tue Feb 2 14:23:02 GMT 2010

hi juan

On 2 Feb 2010, at 14:06, juan kennaugh wrote:

> http://www.mysite.com/about-us/
> 
> extract 'about-us'
> 
> then use the string 'about-us' and add a class of 'on' on a nav item 
> with the id 'about-us'


i'd set an id on body tag, relating to the page slug and then make up some css to hilight it

ie

body#foo-item #nav-items.foo-item,
body#about-us #nav-items.about-us {
color: #F00;
text-decoration:underline
}


as this is presentational, there's no real need to hard code a class of on anywhere.



-- 
Mike Karthäuser
Managing Director - Brightstorm Ltd 
Email: mikek at brightstorm.co.uk 
Web: http://www.brightstorm.co.uk 
Tel: 07939 252144
Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

On 7th March 2010, I am running the Bath Half Marathon to raise sponsorship for the Royal National Lifeboat Institution. 

Visit http://www.justgiving.com/mike-karthauser and help me raise £500 to support UK Lifeguards. 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +