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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:20:31+00:00 2026-06-07T23:20:31+00:00

I am trying to learn jquery and I got an example of a dropdown

  • 0

I am trying to learn jquery and I got an example of a dropdown menu like following:

<html>
<head>
<title>CSS Dropdown</title>

<style type="text/css">

    /* General */
    #cssdropdown, #cssdropdown ul { list-style: none; }
    #cssdropdown, #cssdropdown * { padding: 0; margin: 0; }

    /* Head links */
    #cssdropdown li.headlink { width: 220px; float: left; margin-left: -1px; border: 1px black solid; background-color: #e9e9e9; text-align: center; }
    #cssdropdown li.headlink a { display: block; padding: 15px; }

    /* Child lists and links */
    #cssdropdown li.headlink ul { display: none; border-top: 1px black solid; text-align: left; }
    #cssdropdown li.headlink:hover ul { display: block; }
    #cssdropdown li.headlink ul li a { padding: 5px; height: 17px; }
    #cssdropdown li.headlink ul li a:hover { background-color: #333; }

    /* Pretty styling */
    body { font-family: verdana, arial, sans-serif; font-size: 0.8em; background-color: black; }
    #cssdropdown a { color: white; } #cssdropdown ul li a:hover { text-decoration: none; }
    #cssdropdown li.headlink { background-color: white; background-image: url(bg.gif); }
    #cssdropdown li.headlink ul { background-image: url(bg.gif); background-position: bottom; padding-bottom: 10px; }
</style>
<script language="JavaScript">
    window.onload = function()
    {
        var lis = document.getElementById('cssdropdown').getElementsByTagName('li');
        for(i = 0; i < lis.length; i++)
        {
            var li = lis[i];
            if (li.className == 'headlink')
            {
                li.onmouseover = function() { this.getElementsByTagName('ul').item(0).style.display = 'block'; }
                li.onmouseout = function() { this.getElementsByTagName('ul').item(0).style.display = 'none'; }
            }
        }
    }
    /* or with jQuery:
    $(document).ready(function(){
        $('#cssdropdown li.headlink').hover(
            function() { $('ul', this).css('display', 'block'); },
            function() { $('ul', this).css('display', 'none'); });
    });
    */
</script>
</head>

<body>
    <ul id="cssdropdown">

        <li class="headlink">
            <a href="http://google.com/">Search Engines</a>

            <ul>
                <li><a href="http://google.com/">Google</a></li>
                <li><a href="http://yahoo.com/">Yahoo</a></li>
                <li><a href="http://live.com/">Live Search</a></li>
            </ul>
        </li>
        <li class="headlink">
            <a href="http://shopping.com">Shopping</a>

            <ul>
                <li><a href="http://amazon.com/">Amazon</a></li>
                <li><a href="http://ebay.com/">eBay</a></li>
                <li><a href="http://craigslist.com/">CraigsList</a></li>
            </ul>
        </li>

    </ul>

</body>
</html>

However, it works strangely for me means dropdown menu works but I can only found menu items if I slide onto it.

  • 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-07T23:20:32+00:00Added an answer on June 7, 2026 at 11:20 pm

    If I understand the problem, it is that when you hover one of the dropdown menus then the box that appears is just white, and you have to move the cursor over the links so that they change color and can be seen. To fix this you need to change the styling. Either change

    #cssdropdown li.headlink ul
    

    to have a different background (it has inherited the white background from the parent element) and/or change the styling of

    #cssdropdown li.headlink ul li a
    

    Try changing the background property of these elements and see what happens.

    Edit: Or change the color attribute on #cssdropdown li.headlink ul li a because the text in these elements are white, and thus invisible against the white background.

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

Sidebar

Related Questions

I am trying to learn backbone.js through the following example. Then I got stuck
I'm trying to learn html and jquery. My issue is that I have box
I am trying to learn new stuff about jquery, html, asp .net mvc. I
I have the following controller and view. I am trying to learn jquery in
I'm trying to learn jQuery's ajax functions. I've got it working, but jQuery doesn't
I'm trying to learn from the http://jquery.malsup.com/form/#getting-started example. When I click submit, the alert
As a student, I am trying to learn some JQuery tricks. Here my HTML
I'm trying to learn ASP.NET MVC3 & jQuery, and I'm banging my head with
I'm still trying to learn jquery so bear with me. I have a dual
I'm trying to learn jquery, I've some basics of javascript. I've written this piece

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.