user3347903 user3347903 - 2 months ago 8x
jQuery Question

Bootstrap: Remake jQuery function to work on hover instead of click

I'm using bootstrap and got stuck.
The code below works on click. How can I remake it so it would work on hover? I'm a noob in jQuery..

.on('', '[data-toggle^="button"]', function (e) {
var $btn = $(
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')$btn, 'toggle')
.on('', '[data-toggle^="button"]', function (e) {
$('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))

p.s. It seems like the important string is '[data-toggle^="button"]', since deleting this ruins the functionality
p.p.s. I've already read How to make twitter bootstrap menu dropdown on hover rather than click but it didn't help. I'd prefer not to ruin what I'v already done


Easy solution, is to make CSS

.dropdown:hover .dropdown-menu {
    display: block;