Jump to content


  • Posts

  • Joined

  • Last visited

htrain26's Achievements


Newbie (1/7)



  1. I had tried that along with not using anything and few other trial and error goofs. When I would have either the semi-colon, comma or nothing between the two they would work independently. But when I would add one or both of the other instances, things would get wonky. I changed it back to your suggested semi-colon's and everything seems to be working fine as of now. I must have overlooked something. Either way, thank you!!! I've been looking at this too long. Thanks again!
  2. Hello, (please accuse me for not using technical terms correctly and such, I am a newbie) I'm trying to add an "active" class to two buttons in a nav menu...one goes to the main/top section button and the other on the btn in the drop down. The code that I'm using works, but I have to do this for three pages and when I add the others some buggy stuff starts to happen. Here's the code that I'm using (at least for the home page and the "public safety" section of the site): <script> var current = window.location.href; if ( current == "http://www.tfmcomm.com" || current == "http://www.tfmcomm.com/" || current == "http://www.tfmcomm.com/index.htm" ){ jQuery('#mainmenu > li > a[href=/index.htm]').parent().addClass("current-menu-item"); } else if ( current == "http://www.tfmcomm.com/motorola/accessories/public-safety/" ){ jQuery('.sub-menu > li > a[href$=/motorola/accessories/public-safety/]').parent().addClass("current-menu-item"), jQuery('#mainmenu > li > a[href$=/public-safety/index.htm]').parent().addClass("current-menu-item"); } else if ( current.indexOf("http://www.tfmcomm.com/public-safety/") > -1 || current.indexOf("http://www.tfmcomm.com/motorola/accessories/public-safety") > -1 ){ jQuery('#mainmenu > li > a[href$=/public-safety/index.htm]').parent().addClass("current-menu-item"); }</script> The code in red is where I seem to be running into a problem. As you can see I'm just separating the two .addClass lines with a "comma". I have a feeling that's not legit. I tried to find the correct way to go about this, but with no luck. Any and all help would be greatly appreciated. Thanks in advance, m@
  3. There's gotta be a way to make this work. First when I moved over to the live site, the main menu doesn't show active when those main main menu items are clicked. But, when any of the items on the drop downs of the main menu are selected the current page and the main menu item show active. You can view here: I tried a handful of attempts to get the pages that are not in/on the menu to reflect on the top main menu items, with no luck. I'm trying to figure out a way to make this work or an alternative compromise. Unfortunately, it's not up to me to change the menu's. I'm all ears.
  4. I tend to agree with you about simplifying the menu(s), but unfortunately that's not up to me. I appreciate the honest feedback though!
  5. well, it's not that I don't want to see certain pages reflected as active in the menu. The issue is that I DO want to see certain pages reflected in the main menu. Like I was saying, the pages that fall under but outside of the same directory as a "main topic/page" do not display the main menu item as active. I would like for the "main menu item/category" to display active to at least help show what area the user is in. If that makes sense. Adding all the pages and then hiding them seems pretty counter productive to what we're trying to accomplish using the javascript at hand.
  6. Hello again, I've run into another issue with the whole "displaying active menu item"... Basically, I'm trying to figure out how to have the pages that are not on the main menu to at least display/show active what section. For instance, if you click on "commercial" it takes you here: http://tfmcomm.oiw9.com/motorola/index.htm From that page if you click on "In Building Solutions" from either the main body or the righ hand nav, you end up here: http://tfmcomm.oiw9.com/motorola/in-building-solutions.htm Once on this page, there is nothing showing active in the main menu. I understand that this page isn't directly connected with the main menu, but I'm wondering if there is a way to at least continue to have the "Commercial" button in the main menu display active. There are a lot of pages, especially in the "commerial" section that currently end up not reflecting any main menu items "active". Thanks once again in advance!
  7. Gotcha! Plus it didn't help that I was replacing '$(this).closest('li').addClass('current-menu-item');', but looks like it's working when I add the line after. Thanks soo much!!!!
  8. Yes, you can find it here: http://tfmcomm.oiw9.com sorry about that.
  9. I have the main menu and sub menu's(dropdown menus) reflecting which page the user is on, but I need to have the main menu reflect the the sub's. It currently reflects which page you're on, but I also need the main menu item to be active for the appropiate and active dropdown menu item. Here's the code I'm currently using: <script>$(function () {setNavigation();});function setNavigation() {var path = window.location.pathname;path = path.replace(//$/, "");path = decodeURIComponent(path);$("#mainmenu a").each(function () {var href = $(this).attr('href');if (path.substring(0, href.length) === href) {$(this).closest('li').addClass('current-menu-item');}});} </script> Any and all help is welcome and greatly appreciated, for I am not what you might consider the programming wizard! Thanks, mh
  • Create New...