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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:56:07+00:00 2026-06-13T01:56:07+00:00

I created an horizontal menu with a submenu. On jsfiddle I don’t know with

  • 0

I created an horizontal menu with a submenu. On jsfiddle I don’t know with the submenu isn’t working correctly at 100% instead on local it does. Here is the working link: http://jsfiddle.net/IronFeast/g8MDP/

And here is the code:

<ul id="navbar">
<li><a href="index.php">Home</a></li>
<li><a href="#">Gallery</a>
<ul class="submenu">
   <li><a href="photogallery1.php">Photogallery 1</a></li>
   <li><a href="photogallery2.php">Photogallery 2</a></li>
   <li><a href="photogallery3.php">Photogallery 3</a></li>
</ul>         
</li>
<li><a href="events.php">Events</a></li>
<li><a href="#">Blog</a>
<ul class="submenu">
   <li><a href="personal.php">Personal</a></li>
   <li><a href="dev.php">Dev</a></li>
</ul> 
</li>
<li><a href="#">About</a>
<ul class="submenu">
   <li><a href="page1.php">Page 1</a></li>
   <li><a href="page2.php">Page 2</a></li>
</ul>
</li>

CSS:

#navbar {
 background-color: #4E78B4;
 position: absolute;
 text-align: center;
 margin: 0;
 padding-bottom: 7px;
 padding-top: 7px;
 float: left;
 left: 10px;
 width: 940px;    
 font-size: 14px;
 z-index: 100;
}

#navbar li {
 list-style: none;
 float: left; 
 color: #E9EBDE;
 padding-left: 24px;
 padding-right: 4px;
 z-index: 100;
}

#navbar li a {
 display: inline;
 padding-top: 7px;
 padding-bottom: 7px;
 padding-right: 8px;        
 padding-left: 8px;
 text-transform: uppercase;
 text-decoration: none; 
 font-weight: bold; 
 color: #ffffff;
 z-index: 100;
 text-align: center;
}

#navbar ul li a {
 display: block;
 padding-top: 6px;
 padding-bottom: 3px;
 padding-right: 8px;
 padding-left: 8px;
 text-decoration: none;
 z-index: 100;
}

#navbar li a:hover {
 color: #000000;
 background-color: #ffffff;
 padding-right: 8px;        
 padding-left: 8px;
 z-index: 100;
}

#navbar li ul{
 display: none;  
 background-color: #41B6DC;
 z-index: 100;
}

#navbar li:hover ul, #navbar li.hover ul {
 position: absolute;
 display: block;
 left: 0;
 width: 940px;
 margin: 0;
 padding: 0;            
 z-index: 100;
 margin-top: 7px;
}

#navbar li:hover li, #navbar li.hover li {
 float: left; 
 z-index: 100;
}

#navbar li:hover li a, #navbar li.hover li a {
 color: #000; 
 z-index: 100;
}

#navbar li li a:hover {
 color: #4E78B4; 
 z-index: 100;
}

At the moment when I go with the mouse over the “Gallery”, the submenu will open, but if I click on “Photogallery 1” I will go to that page but unfortunately the menu will close when I am in that page.

I’d like that “Gallery” will be highlighted, the submenu will stay opened and also the “Photogallery 1” button will be highlighted.

Any help would be awesome. Thank you 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-06-13T01:56:08+00:00Added an answer on June 13, 2026 at 1:56 am

    You must add on photogallery1.php, photogallery2.php, etc class attribute with hover as value.

    <ul id="navbar">
        <li><a href="index.php">Home</a></li>
        <li class="<?php echo $_COOKIE["hover"]; ?>"><a href="#">Gallery</a>
        <ul class="submenu">
           <li><a href="photogallery1.php" class="<?php echo $_COOKIE["selected"]; ?>">Photogallery 1</a></li>
           <li><a href="photogallery2.php">Photogallery 2</a></li>
           <li><a href="photogallery3.php">Photogallery 3</a></li>
        </ul>         
        ...
        ...
    </ul>
    

    also add on your css:

    .selected {
        background-color: #ffffff;
    }
    

    It better to use cookie to save menu state.

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

Sidebar

Related Questions

Iam working on a game in which I have created a horizontal scrolling menu
I have created a horizontal menu with a horizontal submenu. Though I want all
I have created a horizontal menu with 5 tab options using a ul and
I have a horizontal menu bar created using ULs and LIs. The issue I
I've created a custom jQuery horizontal menu with drop downs. Initially it just faded
Here's the thing I'm trying to do: I have a horizontal menu created with
I've created a website with horizontal navigation and one level of dropdown menu on
I'm trying to create a horizontal accordion menu in mootools, instead of the standard
On my Master page, I have created a Horizontal menu, styled by CSS. The
I created a drop down nav menu purely in css and everything works correctly

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.