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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:37:34+00:00 2026-05-26T23:37:34+00:00

Okay, so basically I have a Joomla site and a horizontal jQuery nav. I

  • 0

Okay, so basically I have a Joomla site and a horizontal jQuery nav. I need an arrow (“#selector”) to point to the the active top navigation. The nav is in an unordered list. Using jquery I move the arrow on hover (which I want) by assigning a class with the appropriate margin-left value but then once I select that link and it becomes the active parent I need the arrow to stay there until it moves again because of hover action.

So for example:

<style>
#nav li {
list-style: none;
display: inline;
}
#nav_arrow .item-2-selector {
margin-left: 45px!important;
}
</style>

<ul id="nav">
    <li class="item-1 active">Page 1</li>
        <ul>
            <li>SubPage1</li>
            <li>SubPage2</li>
            <li>SubPage3</li>
        </ul>
    <li class="item-2">Page 2</li>
    <li class="item-3">Page 3</li>
    <li class="item-4">Page 4</li>
</ul>

 <div id="nav_arrow">
  <div id="selector" class="position"><img src="nav_current.png"/></div>
</div>

My logic I was hoping to be able to come up with a jQuery solution for was:

WHEN .item-1.active EXIST $(“#selector”).css(‘margin-left’, ’20px’);
WHEN .item-2.active EXIST $(“#selector”).css(‘margin-left’, ’45px’);
WHEN .item-3.active EXIST $(“#selector”).css(‘margin-left’, ’70px’);

…etc…

Basically this is what I’m doing for the hover effect:

<script>

$(document).ready(function(){
$(".item-466").mouseover(function(){
 $("#selector").addClass("item-2-selector");
 });
});
</script>

and here is the URL to my test site so that you can see better exactly what I’m trying to do: http://trustmarkstaging.com

Thanks in advance for any help! 🙂

  • 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-26T23:37:35+00:00Added an answer on May 26, 2026 at 11:37 pm

    The brute force way is this:

    var marginLeft;
    if ($(".item-3.active").length > 0) {
        marginLeft = "70px";
    } else if ($(".item-2.active").length > 0) {
        marginLeft = "45px";
    } else if ($(".item-1.active").length > 0) {
        marginLeft = "20px";
    } else {
        marginLeft = 0;
    }
    
    $("#selector").css("margin-left", marginLeft);
    

    It was unclear to me whether more than one item could be active which is why I test them in reverse order (looking for the highest numbered item that is active).

    A more elegant and extensible method that would work for any number of items might be something like this:

    var marginLeft = 0;
    var active = $("#nav li.active:last");
    if (active.length > 0) {
        marginLeft = ((active.index() * 25) + 20) + "px";
    }
    $("#selector").css("margin-left", marginLeft);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay basically I have an MFC application with lots of dialogs that need to
Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These
Okay, basically, I have a large list of phone numbers in a text file
Okay, so basically I have an enum: public enum A { A, B, C,
Okay so basically : i have this simple example: main.cpp using namespace VHGO::Resource; std::list<BaseTable*>
OKay, I will try to make this make sense lol. Basically I have 4
Okay, basically, I have formed a mySQL query which returns a data set all
Okay, got a question. I have assembled a bit mask for options. Basically my
Okay I'm having a problem. I have a social networking site and have some
Okay so i have a packed a proprietary binary format. That is basically a

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.