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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:22:32+00:00 2026-06-11T06:22:32+00:00

I have an expandable vertical drop down menu that currently expands when first level

  • 0

I have an expandable vertical drop down menu that currently expands when first level items are clicked, however I want it to expand when the menu item is hovered over instead. The original script is:

<script type="text/javascript">
  $(document).ready(function () {
  $('#nav > li > a').click(function(){
  if ($(this).attr('class') != 'active'){
  $('#nav li ul').slideUp();
  $(this).next().slideToggle();
  $('#nav li a').removeClass('active');
  $(this).addClass('active');
    }
  });
});
</script>

I changed .click(function to .hover(function and this works, however I don’t know if it is the best way to do it. Can anyone advise if there is a better way to acheive this? You can see a working example of the .click version of the menu on the left hand side of the page by clicking here. 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-11T06:22:34+00:00Added an answer on June 11, 2026 at 6:22 am

    Changing it to hover is acceptable. It’s definitely very readable code, which is the important thing. However, there is one issue – as Daniel comments, it’ll make your menu impossible to navigate on a touch device, which means that you’re making the site inaccessible on every mobile phone and tablet*. This is a very bad thing, but there are a few things you can do.

    For instance, the jQTouch library has some awesome touch-specific event handling that would let you optimize your menu for mobile users. Otherwise, you could wrap your menu’s JavaScript logic in a conditional, or you could assign each action to both touch and click.

    *except for phones and tablets with mice (a very atypical use case.)

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

Sidebar

Related Questions

I have a set of divs that I want to make collapsible/expandable using jQuery's
i have the following code <div class=hitarea expandable-hitarea></div> <span class=folder>level 1</span> <ul style=display: none;>
I have a report that has 3 expandable columns. I have a condition in
Overview: I have an Expandable List View which displays items of the type ToDoElement
I have an expandable list view where the first group is empty i.e. it
I have a window that will be a variable size , currently it is
I want to add an image icon in expandable list view .I have seen
Hello i have a simple expandable list activity that was working fine until i
I have a table and want to make some of the rows expandable -
I have an expandable list that contains groups : continents and child : countries.

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.