Dropdown hover and click

The w3-dropdown-hover class is perfect for creating navigation bars with dropdown menues:. Note: You will learn more about Navigation Bars later in this tutorial.

It is the most populous city in the United Kingdom, with a metropolitan area of over 9 million inhabitants. Use any of the w3-animate- classes to fade, zoom or slide in the dropdown content:. Use the w3-right class to float the dropdown to the right.

Use CSS to position the dropdown content right:0 will make the dropdown menu go from right to left instead of left to right :. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.

CSS W3. CSS Intro W3. CSS Colors W3. CSS Containers W3. CSS Panels W3. CSS Borders W3. CSS Cards W3. CSS Fonts W3. CSS Text W3. CSS Round W3. CSS Padding W3. CSS Margins W3. CSS Display W3. CSS Buttons W3. CSS Notes W3. CSS Quotes W3. CSS Alerts W3. CSS Tables W3.

CSS Lists W3. CSS Images W3. CSS Inputs W3. CSS Badges W3. CSS Tags W3. CSS Icons W3. CSS Responsive W3. CSS Layout W3. CSS Animations W3. CSS Effects W3. CSS Bars W3.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time.

Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. So clicking a toggle will show the drop-down not hoveringand then the drop-down will hide on mouseleave. I thought it may be possible using combinations of :hover and :active sates but I was unable to make it work. I have it working! I'm not sure if this is the best solution possible, but it seems to work pretty well.

I used an :active handler to show the hidden menu, which is positioned on top of the button, allowing you to continue showing the menu with a :hover handler.

This is adding a z-index of 1 when the corresponding radio button is clicked. Since the body underneath is gaining a z-index over the others it makes the section active. This is not a drop-down, I am providing a working example and it is up to you to make your situation.

How TO - Clickable Dropdown

Learn more. Is it possible to show a drop down on click only using CSS? Asked 6 years, 4 months ago. Active 6 years, 4 months ago. Viewed 5k times. Has anybody tried making or seen a drop-down menu with only CSS, no javascript. I know this can easily be achieved with javascript, but I would like it to work with purely CSS. Your commenters are trying to indicate that your question is too vague for SO's format. Google would have been a better approach.

I'm sorry i was unclear about a specific detail which makes this different, i'll make and edit. The drop down must be triggered by a click, and hidden by mouse leave. I think this makes this question a bit more unique. Active Oldest Votes.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service.

User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It only takes a minute to sign up.

dropdown hover and click

I recently visited this lightspeed's website. They have a dropdown menu for their Product page. I noticed me and other people are clicking on product while its suppose to be a hover.

It will bounce me to the product page and I continue to click on the product page another time before I realize I'll need to hover over it for a second before selecting another option. Is there a standard in doing this hover or click?

Or maybe lightspeed just has a slow ui transition? While I don't think it will make too much difference in as web users are much more familiar with these menus and quickly work it out on a site by site basis, there does appear to be a movement away from using hover menus full stop.

How much of this is due to the growth of mobile devices is open to debate.

Click dropdown menu instead of hover using just CSS?

Regardless, I have included some references for further reading on this topic if you're interested:. You cannot use mouse-hover on touch screens like tablets and large smartphones, and mouse-hover presents accessibility challenges.

Hover also frustrates people if it is triggered by accident, or involves unknown interactions, i. So it is much better to use an explicit mouse-click, coupled with the cursor icon changing to a pointer icon to identify the clickable object, i.

That's a pretty bad IxD. So when the mouse leaves, it should go back to its prior state. I try to recommend against using hovers in mega menus. Hovering introduces extra things to consider, like timing of the hover to trigger the content to appear.

Hover also opens up a can of worms when it comes to ADA standards and accessibility. Also, some users that are rushing will click before the hover can be consumed. I'm against hover because it crushes consistency and responsive methodology.

Turn off "hover to select" in Windows 10

Keeping things consistent means whether we're on a large or small device, we click to reveal submenu items because touch devices can't effectively hover. That interactive consistency also ensures that visitors who become accustomed to interacting with the site on one device aren't surprised if they need to use the site on another device.

This consistent approach also affirms the responsive methodology of not penalizing or segmenting users based on their device or its capabilities. It ends up being a slippery slope and can quickly devolve into "let's play music on desktops and change the color of body text on mobile size devices" to the point that the same site becomes unrecognizable across multiple devices.

Some might advocate for "hover on desktops" but today's devices have blurred the definition of "desktops. There are lots of hidden alleys but it's tough to get lost if you keep your interactions consistent.

It's important however to distinguish the primary navigation items that have dropdowns from the items that do not, as can be seen in the OP's screenshot. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Should nav items be hover or click to activate dropdown? Ask Question. Asked 3 years, 10 months ago. Active 1 year, 8 months ago.Written by Mike Street on 24 th July Navigation drop-downs, or mega menus as they are sometimes dubbed, are becoming more and more common on the web.

A drop-down menu is a navigation block which appears when a link is clicked or hovered - a good example of this can be found on the Plumpton College website.

Navigation drop-downs are often used to help the user get to lower pages on the site without having to click a trail of links. There are articles on the web detailing usability issues with drop-down menushowever, having a drop-down sometimes makes sense, for example, mega menus perform well. In that case, the next question to ask is - do you have it appear on hover, or do you require the user to click to open the menu?

Our preference at Liquid Light is to have the menu open on click of the navigation link. There are several reasons behind this, ranging from accessibility to user experience. There is an alternative line of thinking for the drop-down to appear when the main navigation link is hovered over - this would allow the navigation link to still be navigated to by clicking and although a simple solution initially, this can cause many problems with accessibility.

There is nothing more annoying than sweeping your mouse across the screen to access a sidebar, CTA or even the close button and having several menus and drop-downs appearing unexpectedly in your wake. Using hover menus would mean you would need to have a different experience on touch devices such as tablets. You may initially think the solution would be small screens having click, but Microsoft released a 28 inch touch screen device - that is nearly as big as the average 33 inch tv in the home.

Hover menus do not allow much room for error. If the drop-down requires you to constantly keep your mouse over the navigation item and its children, then there is more room for error.

Being able to click to open a menu and not have that menu disappear until another action is taken allows users to take their time and move the mouse in any direction without the menu disappearing. Many users of the web are used to clicking to interact with something. Clicking links to go to a new page, clicking buttons to submit a form, clicking tabs to reveal more content, clicking stars to submit reviews etc.

The natural instinct is to click the link to reveal a drop-down menu if indicated. If the menu is on hover, this is a break in the interaction flow and expecting the user to use and understand a different motion to use your website. Clicking will also navigate to the page, which can break the users train of thought.

This can become confusing and disorientating. We at Liquid Light are very much in favour of drop-downs being on click. What do you think? Mike is our front-end developer who spends his days buried in CSS and Gulp. His evenings and weekends are spent tinkering with electronics and riding bikes. How refreshing to read a web-design blog that goes counter to a web-design fad. Surely most people cause an unintentional Menu on Hover daily? Extra "work" is required searching for an empty "resting space".

Worst are the occasions when one intends to click a link, perhaps after form-filling - but missing, generating a Hover Menu and clicking within in it, so going elsewhere and possibly losing the form's input. All this to save flexing one's click finger a millimetre!!!

Please can web-designers stick to the intent demonstrated by a click. If not Can any Browsers disable Hover???? Thank you for your comment Jules! Unfortunately, it wouldn't make sense to have the browser disable hover, it's just down to everyone to make the right choice. Thanks for the reply.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time.

Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Nearly all the links on my navbar are dropdowns.

I would like them to appear on hover for large screens, but on click for smaller screens. Is that possible? This doesn't work for me because I don't want the entire dropdown to be invisible on mobile; I'd only like it to be visible on click instead of on hover.

Subscribe to RSS

The other 2 solutions work but don't keep the bootstrap styling. A simpler solution is to just add the 'open' class. After trying many plugins and solutions posted across stackoverflow I came up with rather simple code that:. Here is a slightly modified version of jme11 's Answer based on the Bootstrap 3 documentation for Javascript Dropdowns.

The advantage of using this method is that it enables the drop down to function exactly as intended without having to modify any classes and is therefore cleaner IMO.

dropdown hover and click

Codepen Example. This is simple and works well, but on mobile, if you open a submenu and click on the menu item to close, it doesn't close.

How to click sub menu after mouse hovering the element using actions

Learn more. Asked 5 years, 9 months ago. Active 2 years, 10 months ago. Viewed 29k times. Since the click event is not viable in CSS yet! Instead, use JavaScript to grab the browsers UserAgent string to check against a regex that matches mobile, seen here: stackoverflow.

Please note that large screens can still be touch-only tablets in landscape mode. You can use Modernizr to detect touch capability in the browser. Active Oldest Votes. This solution means that when you're on a desktop, if you hover over the item, the dropdown appears. If you click on it, the dropdown disappears.Keep in touch and stay productive with Teams and Officeeven when you're working remotely.

Learn More. Learn how to collaborate with Office Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. You can help protect yourself from scammers by verifying that the contact is a Microsoft Agent or Microsoft Employee and that the phone number is an official Microsoft global customer service number.

Did this solve your problem? Yes No. Sorry this didn't help. Try enabling click to lock: ClickLock lets you highlight or perform drag and drop items without holding down the left mouse button. Check the box Turn on ClickLock. You can click settings to adjust how long you want to wait before the selection is made.

dropdown hover and click

Doesn't work. These settings are already on. Got anything else? For months I followed in desperation instructions I already knew would not work to reduce random cursor motion. I found it at URL. Go to that page and download the "turn off" option and in case you ever want to turn it back on, immediately also download the "turn on" option. What you get is a small batch file which changes a single setting in the registry.

If you are hypercautious and want to know exactly what you are doing, right-click the file and select "edit". You'll be able then to see which line of the registry you can navigate to, and that the change is entirely a matter of changing a single setting to 0 or back to 1, if you choose to turn the function back on. When I made this change I immediately noticed decreased sensitivity. For instance, if you go to any folder in Windows Explorer and hover over a check box, it will not automatically get an x; you'll actually have to tap the touchpad.A dropdown menu is a toggleable menu that allows the user to choose one value from a predefined list:.

Use any element to open the dropdown menu, e. It is hidden by default, and will be displayed on hover see below. Note the min-width is set to px. Feel free to change this. Instead of using a border, we have used the box-shadow property to make the dropdown menu look like a "card". We also use z-index to place the dropdown in front of other elements.

Tip: Go to our Hoverable Dropdowns to learn more about hoverable dropdowns. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:. Click Me Link 1 Link 2 Link 3. HOW TO. Your message has been sent to W3Schools. W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.

dropdown hover and click

While using this site, you agree to have read and accepted our terms of usecookie and privacy policy. Copyright by Refsnes Data. All Rights Reserved. Powered by W3.