0

Please help me solve the following error when I hover over the main menu the submenu dropdown won't show.

The HTML looks like this:

<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" 
              role="button" aria-expanded="false">
        Page<span class="caret"></span>
    </a>
    <ul class="dropdown-menu" role="menu">
      <li><a href="404.html">404 Page</a></li>
      <li><a href="#">Link Two</a></li>
      <li><a href="#">Link Three</a></li>               
    </ul>
</li>

Javascript code is the following:

$('ul.nav li.dropdown').hover(function() {

  $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeIn(200);

}, function() {

  $(this).find('.dropdown-menu').stop(true, true).delay(200).fadeOut(200);

});
1

1 Answer 1

4

$(document).ready(function() {
    $( '.dropdown' ).hover(
        function(){
            $(this).children('.dropdown-menu').slideDown(200);
        },
        function(){
            $(this).children('.dropdown-menu').slideUp(200);
        }
    );
}); // end ready
.dropdown-menu {
  display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" 
              role="button" aria-expanded="false">
        Page<span class="caret"></span>
    </a>
    <ul class="dropdown-menu" role="menu">
      <li><a href="404.html">404 Page</a></li>
      <li><a href="#">Link Two</a></li>
      <li><a href="#">Link Three</a></li>               
    </ul>
</li>

Sign up to request clarification or add additional context in comments.

2 Comments

links rot answering an OP with a link is not a good for future readers
Did you refer the fiddle?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.