I
I
incel2018-11-28 09:44:48
css
incel, 2018-11-28 09:44:48

How to collapse downdrop-menu on click on menu item?

I know how to handle the click, but how to execute the closing (folding) itself is unknown.
Tried through .collapse, and also removed the show class, puts the attribute aria-expanded = 'false' - it doesn't work.
Thank you!
Shitcode:
https://codepen.io/webgospodin/pen/aQjPqP

Answer the question

In order to leave comments, you need to log in

1 answer(s)
@
@river, 2018-11-28
_

https://codepen.io/anon/pen/RqebbW
remove hover styling for menu items

.dropdown-item:hover + .dropdown-menu,
.dropdown-menu:hover {
    /*opacity: 1;
    display: block;
    transition: opacity .1s .1s;*/
}

add remove class .show on click on menu item
$(a).click(function(){
    $(".dropdown").removeClass("show");
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question