bootstrap-hover-dropdown
bootstrap-hover-dropdown copied to clipboard
doesnt work with only img tag inside dropdown-togggle link
here is the layout:
<div class="visitor_tab">
<a href="#" id="user_icon" class=" " data-toggle="dropdown" data-hover="dropdown" aria-expanded="false">
<img alt="" src="http://0.gravatar.com/avatar/f1cb99d9aba841d2121d3a42b4e7a6ac?s=36&d=mm&r=g" srcset="http://0.gravatar.com/avatar/f1cb99d9aba841d2121d3a42b4e7a6ac?s=72&d=mm&r=g 2x" class="avatar avatar-36 photo" height="36" width="36">
</a>
<ul class="dropdown-menu" role="menu">
<li role="presentation">
<a role="menuitem" tabindex="-1" href="#">Watch Later</a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="#">Latest</a>
</li>
<li role="presentation">
<a role="menuitem" tabindex="-1" href="#">Recomended</a>
</li>
</ul>
</div>
What browsers are you seeing this problem in?
@Hortt You can't just paste arbitrary markup in here if you're trying to show the code. I fixed it this time, but it may be a good idea to familiarize yourself with Mastering Markdown
@CWSpear, Ah, thank you! @jmartin84 Windows Chrome v46.0.2490.80 m
I also get the same when an empty DIV is added. The div has size and abckground image, but no content and this makes the menu not triggering. I guess this is because you assume the dropdown link can't have hoverable children, but that's not the case in most of the cases, when you decorate a menu with images for example.
Changing line 50 to :
if(!$parent.hasClass('open') && !$this.is(event.target) && !$.contains($this[0], event.target)) {
solved it for me, but not sure if it won't caause other issues. Needs a check by someone more into this.