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?

example:

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

source: http://pastebin.com/EaKimzpP



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: http://www.w3schools.com/css/css_dropdowns.asp

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

https://toddmotto.com/html5-and-jquery-super-simple-drop-down-nav/


    CSS Howto..

    How to create a ribbon shape in CSS

    How to use `attr` when not on `content` property [duplicate]

    how to crop big image in bootstrap carousel

    How to @import without including all CSS but just the @extends ones

    how to not inherit? or how to reset inherited width to the value before? (css)

    How to deselect with CSS?

    How to shift a background image with css

    how to set zoom level using css

    How to let users have the latest non cached code?

    How to color portion of text using css or jquery

    How to get the first parent that has a certain CSS property using jQuery?

    How to make one Div's position (not child or parent) completely linked / dependent on another Div's position?

    How to replace only the text of this element with jQuery?

    How should a graphic designer learn web design? [closed]

    How to vertically align Facebook and Twitter share buttons

    How to fit textarea exactly inside a div - CSS

    How to have elements copy other element's auto height css?

    How to adjust CSS to display correctly in IE 6?

    CSS: How to move text link to the right inside li

    Why is last select option always shown, even when styled out

    How to get access to file css in JSF 2.0

    how to do a fade in/out while moving down css animation

    Why do menu bullets show up on my menus?

    How is it possible to modify the gap between a bullet and its list text?

    How to display background-image on entire site

    How to not apply CSS file on a
    ? (Without changing the original CSS file.)

    How to get css height property of an object and add 20px to it?

    how to show line without space in next line when screen gets smaller?

    How Do I Reduce the Padding Around a Chart Within an Article

    How to use “Monotype Corsiva” font in CSS statement?