Is there a way to change css for one class when hovering over an element from another class using only css?
Something like:
.item:hover .wrapper { }
Only the 'wrapper' is not inside the 'item', it is somewhere else.
I really don't want to use javascript for something so simple, but if I need to, how would I do it? Here is my unsuccessful attempt:
document.getElementsByClassName('item')[0].onmouseover="document.getElementsByClassName('wrapper')[0].style.background="url('some url')";";
There is only one element of each class. I don’t know why they didn’t use identifiers when they made the template, but that was exactly the case, and I can’t change it.
[change]
This is the menu. Each menu item has a separate class. When you hover over an item, a submenu appears to the right. This is like an overlay, when I use the "Inspect Element" tool, I see that the whole html site changes when the submenu is active (which means nothing but a submenu). The class that I call the "wrapper" has css that controls the background for the submenu. There really is no connection that I see between the two classes.
javascript css class hover
Kesarion
source share