Displaying a drop down on hover

bootstrap dropdown hover submenu
drop down menu in html on mouseover
bootstrap dropdown-menu on hover example
bootstrap 4 dropdown hover
responsive drop down menu with submenu
bootstrap dropdown on hover
vertical dropdown menu
menu and submenu in html examples

Below is the code I have written to display a dropdown list. The dropdown items display on click, but I want the dropdown list to be displayed on hover and I want the page to redirect to the link provided.

<select id="marketplace">
<option>Select a dropdown</option>
<a href="https://www.amazon.in/"><option>Amazon</option></a>
<a href="https://www.flipkart.com/"><option>Flipkart</option></a>
<a href="https://www.snapdeal.com/"><option>Snapdeal</option></a>
<a href="https://paytm.com/"><option>paytm</option></a>
</select>

I made it using this website http://www.devcurry.com/2009/04/using-javascript-to-dropdown-html.html

And then i add function to redirect to the link ^^ Check this :D

The code demo is over at http://www.dotnetcurry.com/Demos/javascript/HoverSelect.htm

function DropList() {
  var n = document.getElementById("sel").options.length;
  document.getElementById("sel").size = n;
}

function handleSelect(elm){
  window.location = elm.value;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  <select id="sel" onmouseover="DropList()" onmouseout="this.size=1;" onchange="javascript:handleSelect(this)">            
    <option value="https://www.amazon.in/">Amazon</option>
    <option value="https://www.flipkart.com/">Flipkart</option>
    <option value="https://www.snapdeal.com/">Snapdeal</option>
    <option value="https://www.paytm.com/">paytm</option>
  </select>
</div>  

Hover Dropdowns, By default, to open or display the dropdown menu in Bootstrap you have to click on the trigger element. However, if you want to show the dropdown on mouseover  Displaying a drop down on hover. Ask Question Asked 1 year, 11 months ago. Active 1 year, 11 months ago. Viewed 1k times 2. Below is the code I have written to


As W3Shcools You can use instead of select tag div like this implementation

/* Dropdown Button */

.dropbtn {
  background-color: #4CAF50;
  color: white;
  padding: 16px;
  font-size: 16px;
  border: none;
}


/* The container <div> - needed to position the dropdown content */

.dropdown {
  position: relative;
  display: inline-block;
}


/* Dropdown Content (Hidden by Default) */

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1;
}


/* Links inside the dropdown */

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}


/* Change color of dropdown links on hover */

.dropdown-content a:hover {
  background-color: #ddd
}


/* Show the dropdown menu on hover */

.dropdown:hover .dropdown-content {
  display: block;
}


/* Change the background color of the dropdown button when the dropdown content is shown */

.dropdown:hover .dropbtn {
  background-color: #3e8e41;
}
<div class="dropdown">
  <button class="dropbtn">Select a dropdown</button>
  <div class="dropdown-content">
    <a href="https://www.amazon.in/">Amazon</a>
    <a href="https://www.flipkart.com/">Flipkart</a>
    <a href="https://www.snapdeal.com/">napdeal</a>
    <a href="https://paytm.com/">paytm</a>
  </div>
</div>

How to Open Bootstrap Dropdown Menu on Hover Rather than Click, The easiest solution would be in CSS. Add something like .dropdown:hover .​dropdown-menu { display: block; margin-top: 0; // remove the gap so it doesn't  The .dropdown-content class holds the actual dropdown menu. It is hidden by default, and will be displayed on hover (see below). Note the min-width is set to 160px. Feel free to change this. Tip: If you want the width of the dropdown content to be as wide as the dropdown button, set the width to 100%


You can make this by using other html elements such as ul and li like this

.menu {
  
}
.submenu {
  position: absolute;
  left: 0;
  top: 100%;
  display: none; // initially submenu is hidden
}

.menu li {
  position: relative;
}
.menu li:hover .submenu {
  display: block; // shows submenu on hover
}
<ul class="menu">
  <li>Select a dropdown
    <ul class="submenu">
      <li><a href="https://www.amazon.in/">Amazon</a></li>
      <li><a href="https://www.flipkart.com/">Flipkart</a></li>
      <li><a href="https://www.snapdeal.com/">Snapdeal</a></li>
    </ul>
  </li>
</ul>

Bootstrap Dropdown with Hover, Step 3 — Showing the Menu on Mouse Hover. In order for our dropdown to be usable, we need to add some styles to show and hide the menu  The .dropdown:hover selector is triggered when the user’s mouse moves over top of .dropdown. Once this happens, the style display: block; is applied to the last item in the selector .dropdown-menu .


You can achieve this using javascript

function DropList() {
  var n = document.getElementById("sel").options.length;
  document.getElementById("sel").size = n;
}

function handleSelect(elm){
  window.location = elm.value;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
      <select id="sel" onmouseover="DropList()" onmouseout="this.size=1;" onchange="javascript:handleSelect(this)"> 
            <option>Select a dropdown</option>
            <option><a href="https://www.amazon.in/">Amazon</a></option>
            <option><a href="https://www.flipkart.com/">Flipkart</a></option> 
            <option><a href="https://www.snapdeal.com/">Snapdeal</a></option> 
        </select>
    </div>

Creating a Pure CSS Dropdown Using the :hover Selector – Gregory , A common UI pattern that we see on the web are dropdown menus. li { display: block; transition-duration: 0.5s; } li:hover { cursor: pointer; }  The :hover selector is used to show the dropdown menu when the user moves the mouse over the dropdown button.


For creating similar/repetitive elements in HTML, I prefer to use ul li, it makes controlling them more easier.

NO NEED OF JS OR JQUERY, TRY USING MORE CSS!

Code for dropdown

(YOU MIGHT FIND THE CSS WAY TOO LONG, ITS BECAUSE I CUSTOMISED THE ELEMENTS TO LOOK MORE NEAT)

HTML

<div class="navigationWrap"> 
 <ul> 
  <li class="dropdown"><a href="#">Dropdown</a> 
   <ul class="subNav"> 
      <li><a href="#">Dummy One</a></li> 
      <li><a href="#">Dummy Two</a></li> 
      <li><a href="#">Dummy Three</a></li> 
      <li><a href="#">Dummy Four</a></li> 
   </ul> 
  </li> 
 </ul>
</div>

CSS

Using position absolute & relative to display element on hover, and WE ARE DONE!

ul { margin: 0px; padding: 0px; list-style: none; } 
.navigationWrap ul li { width: 100%; float: left; color: #000; font-size: 30px; position: relative; } 
.navigationWrap ul li a { text-decoration: none; color: #000; display: block; } 
.navigationWrap ul li a:hover { color: #04A000; } 
.navigationWrap ul li ul.subNav { position: absolute; width: 150px; padding:10px; background-color: #fff; border: #000 solid 1px; left: 0; top: 100%; display: none; z-index: 999; } 
.navigationWrap ul li ul.subNav li { float: left; width: 100%; font-size: 20px; letter-spacing: 1px; padding: 0; } 
.navigationWrap ul li ul.subNav a { float: left; width: 100%; transition: all 0.3s ease-in-out; display: block; padding: 0 0 0 15px; } 
.navigationWrap ul li ul.subNav li a:hover { color: #04A000; padding-left: 20px; } 
.navigationWrap ul li ul.subNav li.active a { color: #04A000; } 
.navigationWrap ul li.dropdown:hover ul.subNav { display: block; }

JSFIDDLE -- https://jsfiddle.net/neel448/u0Lmb0jv/

Solved with CSS! Dropdown Menus, You haven't specified an action to show the submenu on hover — it's always set to display:none, so it will never show. Try adding this: ul li:hover  A common UI pattern that we see on the web are dropdown menus. They’re used to display related information in pieces, without overwhelming the user with buttons, text, and options. Somewhere that we see these a lot is inside of headers or navigation areas on websites. Let’s see if we can make one of these menus with CSS alone.


Display Submenu Dropdown On Hover, .btn-group:hover .dropdown-menu {. display: block;. } .dropdown-menu {. margin: auto;. } .dropdown-toggle {. margin: auto;. } .navbar .dropdown-toggle, .nav-tabs  Learn how to create a responsive navigation bar with dropdown. /* When the screen is less than 600 pixels wide, hide all links, except for the first one ("Home"). Show the link that contains should open and close the topnav (.icon) */ /* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon.


Dropdown Menu On Hover, up on hover, then it is hiding when clicking on the .dropdown-toggle element, and moving out the mouse will trigger the dropdown menu to show up again. The CSS drop down menu hides content or options until a specific event occurs (usually when :hover triggers). HTML creates the main structure , while CSS adds the main properties to style a button or text as a drop down menu.


How to open dropdown menu on hover in Bootstrap, Whenever you code a pure CSS drop-down menu, you usually have something like this to position drop-downs, make them invisible, and then display them on :hover We will be using the same code to create drop-downs for both menu and filters, that’s why each declaration has 2 selectors – .main-menu and .filters .