Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8224173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:58:19+00:00 2026-06-07T14:58:19+00:00

Hi I seem to be having some problems with my website at the menu.

  • 0

Hi I seem to be having some problems with my website at the menu. When I first load the page the first element of the menu should have a class active on IE9 the class active is extended to every element on the menu and on the other browsers the class isn’t added at all. If I start clicking on the menu buttons everything start’s running normally.

Weird thing is that this only happens on the server if I try loading for example http://www.foxteam.net/ the problem appears but if I load http://www.foxteam.net/index.php the site works normally on all browsers.
This is very confusing for me because from what I know even when you open http://www.foxteam.net/ the browser opens index.php file.

What is the problem in my case?

The menu is in the a separate file called header.php that is included in index.php with include function.

This is the code I have used to create this effect but I doubt it will help because yesterday everything worked fine and today I only worked with the contact page:

<ul id="main-menu">
         <li><a href="index.php" class="active">home</a></li>
         <li><a href="about.php">about us</a></li>
         <li><a href="portfolio.php">portfolio</a></li>
         <li><a href="contact.php">contact us</a></li>
</ul>

jQuery:

$(document).ready(function(){
            var i = document.location.href.lastIndexOf("/");
            var currentPHP = document.location.href.substr(i+1);
            $("ul#main-menu li a").removeClass('active');
            $("ul#main-menu li a[href^='"+currentPHP+"']").addClass('active');
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:58:21+00:00Added an answer on June 7, 2026 at 2:58 pm

    Looking at your page, you are trying to find a link on the page using the page segment of the url.

    When you use http://www.foxteam.net/index.php your code is able to pickup the acnhor with href set to ‘index.php’. However when you use the url http://www.foxteam.net/ the page segment is blank and hence $("ul#main-menu li a[href^='"+currentPHP+"']") is not matching any link.

    Replace the current document load script in your page with this one:

    $(document).ready(function(){
            var i = document.location.href.lastIndexOf("/");
            var currentPHP = document.location.href.substr(i+1);
            $("ul#main-menu li a").removeClass('active');
            var link = $("ul#main-menu li a[href^='"+currentPHP+"']");
            if(link.length < 1) {
                link = $("ul#main-menu li a:first");
            }
            link.addClass('active');
    });
    

    For IE issue: Try this (not tested)

    $(document).ready(function(){
            var i = document.location.href.lastIndexOf("/");
            var currentPHP = document.location.href.substr(i+1);
            $("ul#main-menu li a").removeClass('active');
            var link = $("ul#main-menu li a[href^='"+currentPHP+"']");
            if(currentPHP.length < 2 || link.length < 1) {
                link = $("ul#main-menu li a:first");
            }
            link.addClass('active');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i seem to be having some problems with the Vector class in actionscript 3
I seem to be having some problems with something simple here. I have some
I seem to be having some problems creating a jquery plugin. I am testing
i am having some problems with getting my form to submit. It doesnt seem
I'm quite new to Oracle and seem to having some problems with my query
I am having some problems with a menu that is displayed as tabs (displayed
I am using appengine and seem to be having some problems with url routing
I'm trying to create a website with fluid layout, but im having some problems
I am having some problems passing parameters to a DELETE command, and cant seem
I seem to be having some problems witn my quicksort method. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.