Nav - how to recognize "current"?
|
1493 posts
|
I have this CSS in my Styles.css file: nav li a:hover { background: #3C6787; color: #fff; }nav li a.current { background: #fd9; color: #000; }But the Header snippet does not seem to have any code to recognize "current". It looks like the current Frog site has this working. What do I need to do to get this behaviour in 2.2? Thanks! David. |
|
541 posts
|
humm this is because I have hardcoded the menu. but you can check with |
|
7 posts
|
In the site I'm building I have a main menu and one sub menu. so to have a .selected on my menus I used this: if(in_array($menu->slug, explode('/', $this->url))) { $class = "selected "; }else{ $class = NULL; } haven't tried url_match() or url_start_with() |
|
541 posts
|
ha cool ! I haven't think that way!! if it works it's perfect :) |
|
1493 posts
|
Thanks for this, Nicolas. I tried to implement your code in various ways in the "header" snippet. I inserted it at various points here, and added a "dynamic"
Would be willing to share how you're using your "if" statement more fully? Thanks! David. |
|
1493 posts
|
Ack! My markup went wrong in post #5 -- sorry about that! Hope it's still clear.... |
|
1493 posts
|
And one more thing (sorry!): if the "class" needs to be set on the "anchor" tag, not the "list" tag, how do you get that, because the menu links are generated like this:
(I hope I've entered that correctly this time!) I have looked in the Frog directories for where the "$menu" gets created, but can't find it (or maybe I'm looking in the wrong place!). Thanks again. David. |
|
7 posts
|
Hi david, here's an example. |
|
541 posts
|
end what about this one:
|
|
1493 posts
|
Not just one, but TWO examples, and BOTH work!! MERCI BEAUCOUP Nicolas et Philippe! I wanted to include the "Home" tab at the beginning of my nav. Using the code that Nicolas provided, I came up with this:
I hope I have I entered that correctly. If I didn't, I will post a link to a text file. This is really, really great! Thanks for all the help! David. |
|
1493 posts
|
Well, my "code-block" didn't quite work! :( But if you make the line-breaks like Nicolas's example, it should work. (And I used "current" in my example rather than "selected".) David. |
|
541 posts
|
and what about this one :
|
|
1493 posts
|
and what about this one : Magnifique! :) |
|
44 posts
|
Hello Dear, |
|
1 posts
|
Thanks for kicking off the replies and your thoughts. |