0

I have a dropdown menu implemented with bootstrap3 where I wanna make the dropdown visible only on click instead of hover. My code at the moment:

<li class="dropdown">
  <a href="#" class="dropdown-toggle disabled" id="without-avatar" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
    <i class="fa fa-lg fa-bars"></i>
  </a>
  <ul class = "dropdown-menu">
    <li>......</li>
    ......
  </ul>
</li>

I found some answers where it was said if I use disabled on the a class then the dropdown menu will be available only on click instead of hover. Unfortunately the code is not working. I guess the answer was outdated.

As of 2016 what is the preferred way to solve this problem?

10
  • Have you tried running $("#without-avatar").off("hover")? Commented Mar 3, 2016 at 19:10
  • Tony, I haven't tried any js/jquery since I guess there should be a bootstrap way to solve this problem. Commented Mar 3, 2016 at 19:12
  • Looking at getbootstrap.com/javascript/#dropdowns it has "none" in the options, so there doesn't appear to be any inherent support for disabling/enabling the hover. Commented Mar 3, 2016 at 19:26
  • Can you repro this in a jsfiddle? I created one and it doesn't do anything on hover... Commented Mar 3, 2016 at 19:30
  • Does it do anything on click? Commented Mar 3, 2016 at 19:47

1 Answer 1

2

The Bootstrap dropdown does not drop down on hover. Please check the code on the enclosing elements to find where the problematic hover event is defined.

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

Comments

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.