|
Posted by Rik on 07/28/06 12:57
Yves Lange wrote:
> Neredbojias a ιcrit :
>> To further the education of mankind, Yves Lange
>> <yves.lange@bluewin.ch> vouchsafed:
>>
>>> Hello i wrote a little script in JavaScript which makes my menu
>>> dynamic. The menu can move with the window while the user moves up
>>> or down. But the problem is that when a user click on a link (of
>>> this menu) i want that the background of the cell
Cell? Since when is navigation tabular data? I'd use a ul.
>>> stay in a
>>> specific color which will be useful for the user to know which page
>>> he is reading. How can i do that ?
>>
>> Use the hash and attach it to the url.
>>
> I used PHP...
Quick & easy solution:
I have several pages qith unique names, which are valid classnames.
On every pageload the class of the body is set to that name, and in the list
(and elsewhere), the li's have also classes. The following CSS takes care of
the rest:
..page1 .nav_page1{background-color: #020202;}
..page2 .nav_page2{background-color: #020202;}
..page3 .nav_page3{background-color: #020202;}
Offcourse, if you're building the page using PHP, nothing stops you to make
a class "selected", and check which page is requested with PHP. Just attach
the class to the navigation item of the loaded page.
Grtz,
--
Rik Wasmus
[Back to original message]
|