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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:09:00+00:00 2026-06-17T08:09:00+00:00

I am trying to use this menu for my wordpress site. I am just

  • 0

I am trying to use this menu for my wordpress site.

I am just wondering how can I make the float line change color for each nav item hovered/selected, cos it is red (background-color:#800; height:2px;) for all at the moment.

This is what I am trying to achieve:

Menu 1 – the hovering float line is green,

Menu 2 – the float line is yellow,
Menu 3 – red, menu4 – blue and so on.

Any help is appreciated.

Thank you.

  • 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-17T08:09:01+00:00Added an answer on June 17, 2026 at 8:09 am

    There is a more “CSS” way to achieve this but with some javascript you can get something quite readable. With this approach, your pages will need to correctly initialize the float line (.hightlight) and the nav border (#sses1 > ul).

    The ideal solution would be a class for each float lines but here’s what I got with javascript only :

    <!-- added individual classes for nav items -->
    <div id="sse1">
      <div id="sses1">
        <ul>
          <li><a class="nav-item-1" href="?menu=1&skin=2&p=Javascript-Menus">Javascript Menus</a></li>
          <li><a class="nav-item-2" href="?menu=1&skin=2&p=Horizontal-Menus">Horizontal Menus</a></li>
          <li><a class="nav-item-3" href="?menu=1&skin=2&p=Web-Menus">Web Menus</a></li>
        </ul>
      </div>
    </div>
    

    Before the body or window is loaded :

        function customHandleMenu() {
            // get nav selector
            var nav = $('#sses1 > ul');
    
            // get float line selector
            var floatLine = $('.highlight'); // .hightlight must exist at this point
    
            // get colors for the current page
            var defaultBGcolor = floatLine.css('background-color');
            var defaultBorderColor = floatLine.css('border-color');
            var defaultNavBorderColor = nav.css('border-bottom-color');
    
    
            // change background-color and border-color on mouseenter event
    
            $('.nav-item-1').on({
                mouseenter: function () {
                    setColors({floatColor:'#0f0', borderColor:'#0f0'});
                }
            });
    
            $('.nav-item-2').on({
                mouseenter: function () {
                    setColors({floatColor:'#ee0', borderColor:'#ee0'});
                }
            });
    
            $('.nav-item-3').on({
                mouseenter: function () {
                    setColors({floatColor:'#05f', borderColor:'#05f'});
                }
            });
    
    
            /*
               ...
            */
    
            // put back default colors on the mouseleave event
            $('#sses1 > ul > li').on({
                mouseleave: function() {
                  setColors({floatColor:defaultBGcolor, borderColor:defaultNavBorderColor});
                }
            });
    
            function setColors(args) {
                if (typeof args.floatColor != "undefined") {
                    floatLine.css('background-color', args.floatColor);
                }
    
                if (typeof args.borderColor != "undefined") {
                    floatLine.css('border-color', args.borderColor);
                    nav.css('border-bottom-color', args.borderColor);
                }
            }
        }
    

    To ensure that the selector is only use once .highlight exists, I suggest to modify the end of the original javascript to this:

    function initMenu() {
        sse1.builMenu();
        customHandleMenu();
    }
    
    if (window.addEventListener) {
        window.addEventListener("load", initMenu, false);
    }
    else if (window.attachEvent) {
        window.attachEvent("onload", initMenu);
    }
    else {
        window["onload"] = initMenu;
    }
    

    Take a look at this jsfiddle.

    P.S.: the event chain is slighly modified to fit into jsfiddle.

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

Sidebar

Related Questions

I'm trying to use gridview to make some menu using this tutorial. Unfortunetly, when
Im trying to use this page slider jquery plugin, you can see the demo
I'm trying to use a PHP include or require like this: <div id=menu> <?php
Trying to use this code to render a menu module on a custom template
i am trying to use this code to bind my asp.net menu control to
I'm trying to change the color of a dropdown menu's elements. The dropdown is
Trying to use this method (gist of which is use self.method_name in the FunnyHelper
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,
trying to use this route: from(activemq:profiles).aggregate(header(cheese)).batchSize(30).bean(ProfilesQueueService, saveContacts) Fails with: No signature of method: org.apache.camel.model.RouteType.aggregate()
I'm trying to use this to create a splash screen, but I only get

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.