Mladen Bogomirov Mladen Bogomirov - 28 days ago 23
CSS Question

jQuery click() is not working

I am trying to make a dropdown from a tut a recently saw. It was designed to work with

hover()
but I want it on click event. When I change it like that it is not working anymore.

Here is it on JSFiddle: https://jsfiddle.net/Manny5980/bm0mmo0x/

P.S. Don't mind the irresponsiveness. I'll tidy up. :)

Answer

Hover could take two parameters while click could only take one.

Hover

$( ".a" ).hover(hoverIn(), hoverOut());

Click

$( ".a" ).click(whatHappensWhenYouClick());

This should show the dropdown menu but it won't pull it up, try using toggleClass() to toggle between the dropdown and pull up state.

$(document).ready(function() {
  $('.dropdown').click(function(){
      $(this).children('.options').slideDown(200);
    });
});