Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Location
    Just outside New York City
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS/Javascript navigation page identifier script

    I am trying to figure out how to code this type of horizontal navigation like this site. http://www.maxdesign.com.au/

    When you click on, say, "News", the CSS button turns red and white. I am thinking that this is done with JavaScript and a basic CSS list menu. But I cannot seem to find an example of this the of menu anywhere. The Max Design site is based on WordPress and apparently this navigation uses an API built into the WP framework.

    I need this type of horizontal menu for a custom coded CSS and PHP site.

    Any and all help would be appreciated. Either code or point me to a tutorial.

    Thanks,

    WiLd

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    No. As far as I can see, there must be a server-side code beneath, not JavaScript, which writes different classes. Or server-side includes.

    There might be several solutions. If you say you are using PHP, let us know if you need some examples in PHP.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Location
    Just outside New York City
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Kor,

    Yes. I am using PHP and a server-side method would be excellent. Could you point me to some examples. As I mentioned in the first post, I want to set up navigation so that the CSS button changes to the page it is on.

    All the best,

    WiLd

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you can set a class on <body> on each page of your site, reflecting the location of the page.

    your nav has corresponding classes that match up with these sections.

    as an example, the about page's body tag could look like
    Code:
    <body class="about">
    example html nav
    Code:
    <ul class="nav">
    	<li class="home"><a href='/'>Home</a></li>	
    	<li class="about"><a href='/about/'>About</a></li>	
    	<li class="contact"><a href='/contact/'>Contact Us</a></li>	
    </ul>


    the css
    Code:
    .nav a {color: blue; }
    body.about .nav .about a,
    body.home .nav .home a,
    body.contact .nav .contact a{ color: green; }
    in this fashion the body's class activates a particular navigation item.

    no javascript or server processing needed.
    Last edited by rnd me; 12-10-2010 at 04:28 AM.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •