S
S
sergemin2017-04-14 10:17:59
css
sergemin, 2017-04-14 10:17:59

How to make dropdown menu on hover and not on click?

I have a menu and it has a submenu, made on the Wordpress engine. Added the necessary classes to make the dropdown menu on bootstrap, just need to make it happen on the hover event. I tried to find this code in the bootstrap.js source, but I did not figure it out.
Already tried to do it with css. Yes, the menu drops out on hover, but! The click event does not disappear, which is logical. Those. when you click on the main menu item, the .open class will be added to this item and it will be tinted with the standard bootstrap color and the submenu will remain open until you click somewhere else. Also in bootstrap the main menu is set to preventDefault so I can't navigate to the main menu pages.
What do you advise? Need to edit the bootstrap.js file? I thought that in the customizer you can configure, but there is no such thing. Tell

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergemin, 2017-04-14
@sergemin

found the code in bootstrap.js
THERE is the dropdown plugin section. There are three click events in a row. Changed to hover and it worked

A
Alexander, 2017-04-14
@sanok_ps

How complicated everything is ... Bootstrap, js ...
Something like this:

<ul>
<li><a>Пункт меню</a>
<ul><li>Пункт подменю</li></ul>
</li>
</ul>

ul ul{
display:none;
}
ul li:hover ul{
display:block;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question