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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:25:02+00:00 2026-06-07T20:25:02+00:00

This is going to be difficult for me to explain, so I’ll do my

  • 0

This is going to be difficult for me to explain, so I’ll do my best. Heres this code:

$('#navibar a').hover(function(){
    var position = $(this).position(); 
    var width = $(this).width();
    $('#underliner').css({'width': '' + width + '','left': position.left});
    //$('#underliner').show("slide", { direction: "left" }, 100);
    $('#underliner').stop().animate({opacity: 1}, 30).show();
}, function () {
    var homePos = $(this).find(attr(activePageHref)).position();
    var homeWidth = $(this).find(attr(activePageHref)).width();
    //$('#underliner').css({'width': '' + homeWidth + '','left': homePos.left});
    //$('#underliner').show("slide", { direction: "left" }, 100);
    //$('#underliner').stop().animate({opacity: 1}, 30).show();
    alert(activePageHref);
});

activePageHref is set outside this as the page that has been clicked on. On the alert, it is showing correctly (for examples, lets just say its value is “home”. I need to somehow set the #underliner.css position and width to the page link in the navigation that is selected on hover out, so is there a way to “find” other ‘a’s and use them? Hopefully in the code it’s obvious what I was trying to do. This is my markup:

<ul id="navibar">
            <li><a href="home">Home</a></li>
            <li><a href="products">Products</a></li>
            <li><a href="games">Games</a></li>
            <li><a href="store">Store</a></li>
            <li><a href="support">Support</a></li>
            <li><a href="community">Community</a></li>
        </ul>

Also, I know the first block of code is BIG TIME wrong, that was just the last thing I did out of aggrevation and desperation before I decided to post on here.

  • 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-07T20:25:04+00:00Added an answer on June 7, 2026 at 8:25 pm

    Use the attribute selector to find the link with the href as activePageHref

    $('#navibar a').hover(function(){
        var position = $(this).position(); 
        var width = $(this).width();
        $('#underliner').css({'width': '' + width + '','left': position.left});
        //$('#underliner').show("slide", { direction: "left" }, 100);
        $('#underliner').stop().animate({opacity: 1}, 30).show();
    }, function () {
        var homePos = $(this).parents('#navibar').find('a[href="'+activePageHref+'"]').position();
        var homeWidth = $(this).parents('#navibar').find('a[href="'+activePageHref+'"]').width();
        //$('#underliner').css({'width': '' + homeWidth + '','left': homePos.left});
        //$('#underliner').show("slide", { direction: "left" }, 100);
        //$('#underliner').stop().animate({opacity: 1}, 30).show();
        alert(activePageHref);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This will be a bit difficult to explain but I will try my best.
So this is going to be a bit difficult to explain, but I'll give
This is going to be a bit difficult to explain. I'm usually fine with
Okay, this is going to be hard to explain but here goes nothing: Lately
This is kind of difficult to explain so ill link to a page that
This is a difficult question to articulate, but I'll give it my best: Basically
This is abit difficult to word, so I am going to rely mostly on
Ok this is really difficult to explain in English, so I'll just give an
I am not sure I am going to be able to explain this one
This is going to sound too silly / too basic - sorry about that,

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.