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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:49:55+00:00 2026-06-10T11:49:55+00:00

First post here. Hoping you guys can help. It would be much appreciated and

  • 0

First post here. Hoping you guys can help. It would be much appreciated and I’m sure I’ll learn something. Also, if you see any other redundancies ontop of my problems below, feel free to rip me a new one on coding practices. I need to learn as much as I can asap. On to the problems!

I have two separate scripts that I have half-way there, but I can’t get them to function perfectly.

Up first is the “magicline” script. This animates a line underneath the nav based on what page you navigate to.

What I cannot figure out:
1) How to eliminate the extra line width caused by adding a margin-left:”” to space out the nav items.

Second, loading page content with jquery. I’d love to be able to load my 4 separate pages by just calling the content from the supporting pages section. As of right now, there are two problems. One being, regardless of what page you click on, it reloads the same content over and over. Also, even though the URL updates to the proper page, the navigation “current page” color marker doesnt follow.

To make this much easier to understand, I’ve got a live demo running here:
http://www.youngsaye.net/v2/

Any help will be greatly appreciated.

Thanks!

  • 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-10T11:49:57+00:00Added an answer on June 10, 2026 at 11:49 am

    In looking over the page here’s what I’m seeing:

    1) The magic line script determines the width of the underline based on the element that has the class “current_page_item”.

    Since this is all javascript. You’ll want to set up your menu anchors/links to contain javascript that will update the current_page_item class to the selected item and remove it from the previous one. That should also update your highlighting issue, since it seems that’s css styled.

    A basic script for this would look like this:

    function updateCurrent(e) {
      $('.current_page_item').removeClass('current_page_item');
      $(e).parent('li').addClass('current_page_item');
    }
    

    And all your anchors would have an onClick that looks like:

    <a href="print.html" onclick="updateCurrent(this);">Print</a>
    

    2) I’m not fully following on the main point of your second question. Navigation looks to point to the proper content when I’m going through it.

    EDIT for my added comment below:

    $('#topnav li a').click(function(){
        // Update the current item.
        $('.current_page_item').removeClass('current_page_item');
        $(this).parent('li').addClass('current_page_item');
    
        var toLoad = $(this).attr('href')+' #content';
        $('#content').hide('fast',loadContent);
        window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
        function loadContent() {
            $('#content').load(toLoad,'',showNewContent())
        }
        function showNewContent() {
            $('#content').show('normal',hideLoader());
        }
        function hideLoader() {
            $('#load').fadeOut('normal');
        }
        return false;
    
    });
    

    EDIT Part 2:
    I see you’re still having issues getting the magic line to disregard your width, what you need to do is while the anchor’s are clicked, the same math you applied on initial load should be done as well.

    Updated magic line js should look like:

    // DOM Ready
    $(function() {
    
    $("#topnav").append("<li id='magic-line'></li>");
    
    // get the left margin of current page item
    var marg = parseInt($(".current_page_item a").css("marginLeft"));
    
    
    /* Cache it */
    var $magicLine = $("#magic-line");
    
    $magicLine
        .width($(".current_page_item a").width())
        .css("left", $(".current_page_item a").position().left + marg)
        .data("origLeft", $magicLine.position().left)
        .data("origWidth", $magicLine.width());
    
    $("#topnav li").find("a").click(
        $el = $(this);
        // Do the math for each click
        leftPos = $el.position().left + marg;  
        newWidth = $el.parent().width() - marg;
    
        $magicLine.stop().animate({
            left: leftPos,
            width: newWidth
        });
    }, function() {
        $magicLine.stop().animate({
            left: $magicLine.data("origLeft"),
            width: $magicLine.data("origWidth")
        });    
    });
    
    /* Kick IE into gear */
    $(".current_page_item_two a").mouseenter();
    

    });

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My first post here – hoping you can help me with designing an algorithm
first time post here. I was hoping someone could help me make custom SPARQL
Frequent visitor but first post here on StackOverflow, I'm hoping that you guys might
first post here, I come in peace :) I've searched but can't quite find
first post here on stack overflow, hoping to get some advice on how to
first post here, hoping someone could perhaps shed some light on an issue I've
First post here, so please bear with me if I get something wrong. I'm
first post here. I'm a novice programmer as you'll see, and I'm learning to
first post here as I'm stuck with my wonderful C++ function. The error I'm
First post here... I normally develop using PHP and Symfony with Propel and ActionScript

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.