How to check if an element has a hover property and do something to another element in css [closed]

Tags: html,css,html5,css3

Problem :

So I'm try to make something in C.S.S and i want to make a drop-down kind think and i don't know how to check if an element has a hover property and do something to another element in C.S.S how to do that?


if(element 1 has hover) { do something to element 2 }


Solution :

This comes in two parts:

  1. To see if hover is enabled, look at the tag, and see if the has a tag:hover element in the CSS.

  2. To action something else on the page based on hover, then you need JQUERY:

    $().hover( function() { Do Something; } );

Hope this helps.

Adding a reference from W3Schools to aid you in Drop down menu development:

update 1: This example provides a solution that allows you to adjust for transitions. Requires JQUERY library:

    CSS Howto..

    How to add an image to xml sheet using css

    Fill dynamic
    's with content. But how to show it?

    How to start a css animation from current position

    How to layout images in a grid? [closed]

    How do I 'freeze' a block level element?

    How do I fix this div overflow?

    How to make div to match image height with CSS

    How can I toggle the background color of the body of my HTML document, with one button?

    How to get a tight div when heights differ? [duplicate]

    How can I create a fluid and responsive horizontal toolbar with affix in Bootstrap 3?

    How am I supposed to address elements that are not a direct child of a given element in CSS?

    CSS slide page up animation- element briefly shows before the animation

    How To Remove Scroll Bars? & Auto Scroll?

    How to remove the margin top from a div with display table-cell?

    How can you have your websites resolution change according to the users screen resolution?

    How to select the specific position element in the certain class in CSS

    How to convert CSS class to id?

    JavaFX: How not to fill background outside the rounded borders of a Label within a ScrollingPane

    How to refer css style from another?

    how to validate IE 7/8 CSS hacks?

    How to run/debug Web Application project without cache/cookies?

    jquery .show() from only the selected div

    How to do Vertical+Horizontal centering in CSS

    How to use CSS to ensure items remain offscreen even if window is resized?

    How do you create slidedown effects like this?

    How to make video responsive for all the screen sizes?

    jQuery glowing animations : how to improve?

    How to load css into html dynamically?

    How do you make a floated element fill the remaining horizontal space when it is between its fixed width siblings?

    How to conditionally load CSS and extend it using SASS/SCSS