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

  • SEARCH
  • Home
  • 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 7182105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:41:58+00:00 2026-05-28T17:41:58+00:00

Update Thanks to @mrtsherman verifying my code was fine, I dove into the CSS

  • 0

Update Thanks to @mrtsherman verifying my code was fine, I dove into the CSS and found that for no reason in particular, ie7 wanted a bit of extra padding on the bottom. This is why I hate ie7.

I have some pretty simple code automatically adding a class to the nav item corresponding with the current page. Works fine in all browser including ie8 and ie9 but seems to just not function in ie7. Who’s broken, ie7 or me?

html:

<div id="navbar">
<ul>
<li class="navitem"><a href="about.html">about us</a></li><!--navitems-->
<li class="navitem"><a href="purchase.html">purchase</a></li><!--navitems-->
<li class="navitem"><a href="sales.html">sales</a></li><!--navitems-->
<li class="navitem"><a href="contact.html">contact</a></li><!--navitems-->
</ul>
</div><!--navbar-->

js file

$(function(){
        var full_url = document.URL; 
        var url_array = full_url.split('/')
        var $last_segment = url_array[url_array.length-1]; 
        $('#navbar li a').each(function(){
            var $href = $(this).attr('href');
            if ( ($href == $last_segment) || ($href == '') ) {
                $(this).addClass('curr');
            } else {
                $(this).removeClass('curr');
            }
        });
    });
  • 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-05-28T17:41:59+00:00Added an answer on May 28, 2026 at 5:41 pm

    The more I think about it, the more I think the problem must have to do with the split of your url. If there is a trailing slash then the $last_segment will be an empty string, thus never matching. You should check and trim that before splitting.

    http://jsfiddle.net/zGbJx/2/

    var full_url = "http://www.mysite.com/contacts.html/";
    var full_url = "http://www.mysite.com/contacts.html";
    //trim trailing slash
    if (full_url.charAt(full_url.length - 1) == '/') {
        full_url = full_url.substring(0, full_url.length - 1);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Where do I find the javax.crypto source code? --update Thanks for the OpenJdk version,
UPDATE : thanks to posters below, it's clear that the official documentation is up-to-date.
[Update: Thanks to Craigy's suggestion below, I cleaned up my code a little and
Update: Thanks a lot to everybody who responded!!! It made me feel that I'm
[UPDATE] Thanks guys,final code: var EUR_share_cost = 0; var USD_share_cost = 0; var GBP_share_cost
UPDATE : Thanks for all the quick responses. Should have probably clarified that I've
Update: Thanks for closing my question because it might solicit opinions or discussion. That
UPDATE: Thanks to everyone for the responses. I didn't realize document.write() was deprecated. Add
Update: Thanks for the suggestions guys. After further research, I’ve reformulated the question here:
Update Thanks to Marc's help the AlphaPagedList class is now available on CodePlex if

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.