Bootstrap 3: Collapse on hover and set in the click

3

I would like to know how to do Bootstrap 3 Collapse in the Hover and if it is clicked it will be fixed (Do not close) and only close if another collapse is clicked.

With the following code I was able to get it to open in the hover, but I can not pin it to the click.

// Classe .menu-header abraça todo o collapse para que ele nao feche ao retirar o hover do botão.
$('.menu-header').hover(function () { 
    $('#administrativoCollapse').toggleClass('in');
});
    
asked by anonymous 25.05.2015 / 19:39

1 answer

2

You can use the following code so that when you click, in addition to setting the class to leave it open, you remove the hover event.

$('.menu-header').click(function () { 
    $('#administrativoCollapse').toggleClass('in');
    $('#menu-header').off('hover');
});
    
25.05.2015 / 21:43