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 691825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:35:09+00:00 2026-05-14T02:35:09+00:00

I’m building a navigation system using jquery scrollto. I have my navigation menu in

  • 0

I’m building a navigation system using jquery scrollto. I have my navigation menu in a separate file (( navigation.php )). It is included in 5 locations on the first page (( 5 different sections w/ text following each )). I’m trying to figure out a way to have the current “tab” highlight’d. I could hard code the navigation in each location to ensure it shows up the correct way, but I’d rather use the phpinclude() method. The other issue is that each “tab” has it’s own unique color (( cmykd )). Here is the alpha version of what I’m doing (( when you click && the page slides, the “active tab” still stays grey — I’d like it to be the corresponding color )).

Hope this all makes sense && thanks in advance !!

  • 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-14T02:35:10+00:00Added an answer on May 14, 2026 at 2:35 am

    Few things first.

    You have the same <ul> in multiple places, each with the same id. Same with the multiple <li> elements sharing IDs. This is not only invalid HTML but just a bad practice in general.

    Secondly, your document outline is backwards. Your text is in <h2> elements whereas your navigation/headers are in <h3> elements. This is also invalid and a bad practice.

    Next, let’s talk about rest of the HTML for your navigation bars (which are doubling as section headers) and their content sections. Let’s look at new HTML for two of them (Creativity and Minimalism)

    <div id="a1" class="section creativity">
      <ul class="nav">
        <li class="creativity"><a href="#a1">Creativity</a></li>
        <li class="minimalism"><a href="#a2">Minimalism</a></li>
        <li class="youthfulness"><a href="#a3">Youthfulness</a></li>
        <li class="kuler"><a href="#a4">Kuler</a></li>
        <li class="design"><a href="#a5">Design</a></li>
      </ul>
      <p>Lorem ispum...</p>
    </div>
    
    <div id="a2" class="section minimalism">
      <ul class="nav">
        <li class="creativity"><a href="#a1">Creativity</a></li>
        <li class="minimalism"><a href="#a2">Minimalism</a></li>
        <li class="youthfulness"><a href="#a3">Youthfulness</a></li>
        <li class="kuler"><a href="#a4">Kuler</a></li>
        <li class="design"><a href="#a5">Design</a></li>
      </ul>
      <p>Lorem ispum...</p>
    </div>
    

    The key takeaways here are

    • Semantic use of elements
    • Semantic use of class names
    • No behavior

    Next, the CSS changes

    div.section ul.nav {
      font: 35px 'ChunkFiveRegular', Arial, sans-serif;
      letter-spacing: 0;
      padding: 0px;
      margin: 0px;
      border-top: 1px solid black;
      border-bottom: 1px solid black;
      width:100%;
      list-style-type: none;
    }
    
    div.section ul.nav li {
      display:inline;
      padding: 0px;
      margin: 0px;
    }
    
    div.section p {
      font: 36px 'ChunkFiveRegular', Arial, sans-serif;
      letter-spacing: 0;
    }
    
    div.section.active ul.nav li a {
      color: #ddd;
    }
    
    a:link {color:#999; text-decoration: none;}
    a:visited {color:#999; text-decoration: none;}
    a:hover {color:#000; text-decoration: none;}
    
    li.creativity a:hover, div.creativity.active li.creativity a {color:#00ffff !important;}
    li.minimalism a:hover, div.minimalism.active li.minimalism a {color:#ff00ff !important;}
    li.youthfulness a:hover, div.youthfulness.active li.youthfulness a {color:#ffff00 !important;}
    li.kuler a:hover, div.kuler.active li.kuler a {color:#000000 !important;}
    li.design a:hover, div.design.active li.design a {color:#666666 !important;}
    

    Key takeaways here are

    • Semantic use of class names
    • Inheritance based coloring

    And finally, the modification to your jQuery

    jQuery.noConflict();
    
    jQuery(function($)
    {
      $("ul.nav li a").click(function( event )
      {
        event.preventDefault();
        var target = $(this).attr( 'href' );
    
        $.scrollTo(
            target.replace( '#', '' )
          , {   duration: 800
              , axis: "y"
              , onAfter: function()
                {
                  $( 'div.section.active' ).removeClass( 'active' );
                  $( target ).addClass( 'active' );
                }
            }
        );
      });
    
      $(".return-top").click(function()
      {
        $.scrollTo("body", {duration: 800, axis:"y"});
      });
    });
    

    Key takeaways here are

    • Behavior removed from links is added here
    • Now relies on CSS classes, not IDs
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.