Yanika Mifsud
Yanika Mifsud

Reputation: 13

jquery drop down menu not working with hover

My slidedown function of jQuery is not working this is the jquery code

<script src="jQuery/jquery-1.12.4.js" type="text/javascript">
            $(document).ready(function(){
             $("ul.drop > li").hover(function(){
                $(this).find("ul.up").Toggle(550);
             })
            });
        </script>

And the html :

    <div id ="navMenu">
        <ul class="drop">
            <li><a href = "#">Home</a></li>
            <li><a href = "#">Types</a></li>
            <li><a href = "#">Facts</a>
                <ul class="up">
                    <li><a href = "#">T1</a></li>
                    <li><a href = "#">T2</a></li>
                    <li><a href = "#">T3</a></li>
                    <li><a href = "#">T4</a></li>
                    <li><a href = "#">T5</a></li>
                    <li><a href = "#">T6</a></li>
                </ul>
            </li>
    <li><a href = "#">Contact</a></li>
    </ul>
    </div>

Upvotes: 1

Views: 587

Answers (2)

Mahendra Kulkarni
Mahendra Kulkarni

Reputation: 1507

Here is working example,

  $(document).ready(function(){
         $("ul.drop > li").hover(function(){
         $("ul.up").toggle(1000);
       })
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
   <div id ="navMenu">
        <ul class="drop">
            <li><a href = "#">Home</a></li>
            <li><a href = "#">Facts</a>
                <ul class="up">
                    <li><a href = "#">T1</a></li>
                    <li><a href = "#">T2</a></li>
                    <li><a href = "#">T3</a></li>
                    <li><a href = "#">T4</a></li>
                    <li><a href = "#">T5</a></li>
                    <li><a href = "#">T6</a></li>
                </ul>
            </li>
            <li><a href = "#">Contact</a></li>
        </ul>
    </div>

Upvotes: 0

C14L
C14L

Reputation: 12558

Use one script tag to load jquery, then another to inline JS.

<script src="jQuery/jquery-1.12.4.js"></script>

<script>
  $(document).ready(function(){
    $("ul.drop > li").hover(function(){
      $(this).find("ul.up").toggle(550);
    })
  });
</script>

Also, as @anu pointed out, its .toggle() with lowercase "t".

Upvotes: 1

Related Questions