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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:19:45+00:00 2026-06-17T10:19:45+00:00

I’m new with jQuery and I’m trying to solve an issue with my navigation.

  • 0

I’m new with jQuery and I’m trying to solve an issue with my navigation. I built a vertical menu with many nested lists. It’s purely CSS but my client requested that the sub menu currently open stays open for a second or so when you’re no longer hovering over it.

Here’s the site I’m working on: http://dev.musgraveagencies.com/

And here is the site they currently have, and how they want the menu to delay: http://www.musgraveagencies.com/

I believe I can use jQuery to achieve this, but I want the site to work as is if Javascript isn’t enabled.

Edit: Thanks for everyone’s help! Here is the final code below.

My HTML:

<body class="nojs">
        <div id="nav">
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">Development Projects</a>
                <ul>
                    <li><a href="#">Design Build</a>
                        <ul>
                            <li><a href="#">Interior Design</a>
                                <ul>
                                    <li><a href="#">Project Example</a></li>
                                </ul>
                            </li>
                            <li><a href="#">Project Example 1</a></li>
                            <li><a href="#">Project Example 2</a></li>
                            <li><a href="#">Project Example 3</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Industrial</a>
                        <ul>
                            <li><a href="#">Project Example 1</a></li>
                            <li><a href="#">Project Example 2</a></li>
                            <li><a href="#">Project Example 3</a></li>
                            <li><a href="#">Project Example 4</a></li>
                        </ul>
                    </li>
                    <li><a href="#">Residential</a></li>
                    <li><a href="#">Neighbourhood</a></li>
                </ul>
            </li>
            <li><a href="#">Contact</a></li>
        </ul>
        </div>
    </div>
</body>

My CSS:

#nav {
    width: 156px;
    font: 9pt 'TeXGyreScholaRegular', Arial, sans-serif;
    text-align: left;
}

#nav ul a {
    color: #fff;
    display: block;
    overflow: auto;
    line-height: 19pt;
    text-indent: 2px;
}

#nav ul a:hover {
    color: #fff;
    text-decoration: none;
}

#nav ul li:hover {
    background: #484848;
}

#nav ul {
    width: 156px;
}

#nav ul li {
    list-style: none;
    background: #000;
    position: relative;
    z-index: 100;
}

#nav ul li ul {
    position: absolute;
    width: 156px;
    top: 0;
    left: 156px;
}

body.nojs #nav ul li ul  {
    display: none;
}

body.nojs #nav ul li:hover > ul {
    display: block;
}

My jQuery:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('#nav ul li ul').hide();
        $('body').removeClass('nojs');

        var config = {    
            sensitivity: 2, 
            interval: 200,    
            timeout: 700, 
        };

        var animating = false;

        $('#nav ul li').hoverIntent(
        function () {
                animating = true;
                $('> ul', this).fadeIn(100, function() {
                    animating = false;
                });
        },

        function () {
            animating = true;
            $('> ul', this).delay(400).fadeOut(200, function() {
                animating = false;
            });
        });
    });
</script>
  • 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-17T10:19:47+00:00Added an answer on June 17, 2026 at 10:19 am

    The problem with the code is, you are triggering a transition (fade) with jQuery but hiding the element immediately with your CSS. So this happens with no delay.

    You can use the transition-delay or animation-delay properties with CSS3 but these are not supported in IE. All others support them but not with most versions.

    transition-delay: 2s;
    -moz-transition-delay: 2s; /* Firefox 4 */
    -webkit-transition-delay: 2s; /* Safari and Chrome */
    -o-transition-delay: 2s; /* Opera */ 
    

    So, I think you should migrate most of the CSS (hover pseudo-classes) to javascript/jQuery and hide/show with delay using the setTimeout() method or jQuery’s delay() method.

    UPDATE:

    Since you are concerned if javascript is not enabled in the user’s browser; without javascript and CSS delay related properties, I don’t think it is possible to delay a change on an HTML element’s appearance.

    So what you can do is;

    1. Create a CSS only version of the menu (with using transition-delay and/or animation-delay CSS3 properties if you want the delay). If these properties are not supported on the browser, only down-side is you won’t get the “delay”, but your menu will still work.
    2. Create a javascript version of the menu (with setTimeout etc methods for delay).
    3. Use the <noscript> tags for non-javascript content and your CSS-only menu and place them inside it.

    This way you will have both users satisfied.

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to select an H1 element which is the second-child in its group

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.