aleejelly
aleejelly

Reputation: 73

jquery dropdown not working

Can anyone tell me why my dropdown menu isn't working? I feel like this is a very simple fix but I'm unable to figure it out.

HTML

    <div id="Build" class="dropdown_head col-xs">
        <h1>Build</h1>
        <img src="assets/images/img_1.png">
    </div>    

    <div class="dropdown col-xs">
        <p>Some things are written here</p>

         <img src="assets/images/img_21.png" style="float: right;"> 
    </div>

Jquery:

$(document).ready(function(){

$(".dropdown_head").on('click'.function(){
    $(".dropdown").slideToggle("slow");

    });

});

CSS:

.dropdown_head{
    width: 100%;
    height: 90px;
}

.dropdown{
    font-family: 'Dosis';
    width: 100%;
    height: 300px;
    margin-left: 20px;
    margin-top: 30px;
    display: none;
}

Upvotes: 1

Views: 1206

Answers (3)

Devendra Soni
Devendra Soni

Reputation: 1934

i have created jsfiddle example for you using your code:-

$(document).ready(function(){

$(".dropdown_head").on('click',function(){

    $(".dropdown").slideToggle("slow");

    });
})

you were using . instead of , in this $(".dropdown_head").on('click',function() line.

click to see working example:- http://jsfiddle.net/Xuu3K/8/

Upvotes: 0

Sid
Sid

Reputation: 1144

You have a '.' between 'click' and function when you should have a ',' instead. Change your JavaScript to the following:

$(document).ready(function(){
  $(".dropdown_head").on('click', function() {
    $(".dropdown").slideToggle("slow");
  });
});

Upvotes: 0

user3871221
user3871221

Reputation: 61

$(".dropdown_head").on('click'.function(){
$(".dropdown").slideToggle("slow");

});

Looks like a . instead of a , near function()

Upvotes: 4

Related Questions