Active link in sub-menu

jlee / 2008-06-04 15:00:24   

Hello,

I've figured out how to keep the current page's respective link highlighted on the menu, but how do I do that in the "sub-menu" running horizontally at the top of this page:

http://jenniferleedesign.com/index.php?/work/hhmi-bulletin-may-08/

Additionally, as soon as you click on "HHMI Bulletin" in the left menu, you're automatically at "May '08" so how do I get "May '08" highlighted as soon as you click on "HHMI Bulletin"?

Thanks in advance.

Vaska A / 2008-06-04 15:11:05   

Jennifer, you realize you don't have a link back to Indexhibit, right?

jlee / 2008-06-04 15:47:12   

Am I allowed to put the Indexhibit link in another menu, as shown on my site?

http://jenniferleedesign.com/

Vaska A / 2008-06-04 16:23:50   

Sure, if you want. Your site is quite nice...why don't you make an "About Me" page instead...put a short bio and email link...and then put a link to us thing. We're not doing this to make sites ugly...we're designers too.

Thanks very much for doing that.

The deal with your link...your pages are not generated by plugin right? You do them manually...what you can do is add a style to make the currrent link active (you add this when you add your html to the pages).

For instance a link might look like this instead...


<a href="http://jenniferleedesign.com/index.php?/work/hhmi-bulletin-may-08/" class='highlight'>
May '08
</a>

Note that I added a class "highlight" to the active link...

Then style the link to suit your needs...


a.highlight { font-weight: bold; color: red; }

;)

jlee / 2008-06-04 17:17:18   

Thanks for the compliment! My site is still a work in progress. No one really knows about it, except the good people at Indexibit. When it is complete, I will have an "About Me" section (with an Indexibit link) and "Links" section.

I got it to work for the most part. When I click on "HHMI Bulletin," "HHMI Bulletin" and "May '08" are highlighted, like I want. But when I click on "Feb 08," "HHMI Bulletin" then becomes unhighlighted.

How do I get "HHMI Bulletin" to stay highlighted in tandem with sections "Feb '08," "Nov '07," "Aug '07" and "May '07"?

Vaska A / 2008-06-04 19:04:33   

You basically need to add the class=highlight to each page you create...for the active link.

jlee / 2008-06-04 21:59:34   

I did that. The problem is, "HHMI Bulletin" on the left menu doesn't stay active once I go to these pages:

Feb 08
Nov 07
Aug 07
May 07

For some reason, this code in my CSS file doesn't seem to want to apply to the secondary pages:


#menu li.active a{ color: #00CC00; }

...Unless I completely missed the point and am doing something totally stupid.

srunkel / 2008-08-24 13:23:59   

Hi Jennifer,
My site is VERY much in progress, www.listensenserespond.com

I'm wondering if you can go into detail about how you built your pages? I'm a coding novice, but really need the functionality that you have integrated in your site (the horizontal navigation in your project pages).

I'm wanting to get my "project overview text" off the same as the work samples.

Any help you can provide would be greatly appreciated!

Feel free to contact me directly at: srunkel@listensenserespond.com

Much Thanks!

Scott Runkel

Vaska A / 2008-08-24 13:29:13   

How about if you contact her...that post is a couple months old now.

And she did it with Indexhibit and plain old html.

clapclapclap / 2010-05-11 19:28:27   

For some reason I can't start a new thread, but this post is related.

This is a bit of a ridiculous question, and I'm quite sure the solution is simple but it's been killing my progress for way too many hours now, so if anyone could help it would be much appreciated.

My js skills leave something to be desired and when combined with the php variables I'm just a mess.

To get around this and still have a custom menu I just used css and typed out my secondary link lists in the index file. Now the menus are functioning the way I want, appearing on the appropriate pages, but I can't get the active links in the sub menus to highlight.

ie: click "profile" and "process" appears in the sub-menu area, but when you click "process" I can't get "process" to stay pink.

I thought I could fix this with a little script like this

  1.  $(function(){
  2.    var path = location.pathname.substring(1);
  3.    if ( path )
  4.      $('#sub_select a[href$="' + path + '"]').attr('class', 'selected');
  5.  });

I also rather blindly tried

  1. <?php
  2. if strpos$_SERVER'PHP_SELF' 'index.php?/process' echo 'class="active"'
  3. ?><a href="<%baseurl%>/index.php?/process/">Process</a>


But neither seem to be working. Any ideas?

oh and this is my site

Thanks!

Vaska A / 2010-05-11 19:39:55   

You can start threads...it's a bug. When you input too much code into a new entry it kills it. Sorry about that...you have full rights just like everybody else.

jesshami / 2010-05-11 20:00:57   

Ah okay thanks

clapclapclap / 2010-05-11 20:02:30   

Weird, I will try again with less code. Thanks!

This thread has been closed, thank you.