I am trying to do bootstrap dropdown menu showing on mouseenter. That is not problem, just need some jquery like:
$('.dropdown-toggle').on('mouseenter', function () {
$('.dropdown-toggle').dropdown('toggle')
});
What I need is for example div divided to two sections. In each section there will be link to something (using Nette framework so there will be link to specific action and presenter). But I can't achiev it. If dropdown works, link doesn't.
Structure should be like:
<div class="dropdown-toggle" data-toggle="dropdown">
<div>
<a href="{plink :User:Dashboard:default, 'userId' => $user->getId()}">
<span class="text-white"><i class="fa fa-user"></i> {$userData["user"]["name"]}</span>
</a>
</div>
<div>
<a href="{plink :Account:Edit:default}">
<i class="fa fa-plus-square text-white btn-xs"></i><span class="text-warning"> {_}Není nastaven aktivní účet{/_}</span>
</a>
</div>
</div>
Found some tips, to use data-target attribute, but do'nt know how exactly. https://getbootstrap.com/
EDIT: jQuery:
$('.dropdown-toggle').on('mouseenter', function () {
$(this).dropdown('toggle');
$('.dropdown-toggle>div>a').on('click', function () {
location.href = $(this).attr('href');
});
});
$('.dropdown').on('mouseleave', function () {
$('.dropdown-toggle').dropdown('toggle');
});
Structure:
<button class="dropdown-toggle" data-toggle="dropdown">
<div>
<a href="{plink :User:Dashboard:default, 'userId' => $user->getId()}">
<span class="text-white"><i class="fa fa-user"></i> {$userData["user"]["name"]}</span>
</a>
</div>
<div>
<a href="{plink :Account:Edit:default}">
<i class="fa fa-plus-square text-white btn-xs"></i><span class="text-warning"> {_}Není nastaven aktivní účet{/_}</span>
</a>
</div>
</button>