on hover dropdown bootstrap 4 code example

Example 1: create a dropdown in html bootstrap

<div class="dropdown">
  <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown
  </button>
  <div class="dropdown-menu" aria-labelledby="dropdownMenu2">
    <button class="dropdown-item" type="button">Action</button>
    <button class="dropdown-item" type="button">Another action</button>
    <button class="dropdown-item" type="button">Something else here</button>
  </div>
</div>

Example 2: bootstrap dropdown on hover

<body>
<style>
	.dropdown:hover>.dropdown-menu{
		display: block;
	}
</style>
</body>

Example 3: bootstrap hover dropdown

...
<div class="collapse navbar-collapse" data-hover="dropdown" data-animations="fadeInDown fadeInRight fadeInUp fadeInLeft>
    <ul class="nav navbar-nav">
    ...
    </ul>
</div>
...
or
...
<div class="collapse navbar-collapse">
    <ul class="nav navbar-nav" data-hover="dropdown" data-animations="fadeInDown fadeInRight fadeInUp fadeInLeft>
    ...
    </ul>
</div>
...

Tags: