Reputation: 133
On the page biztone.co, in the left sidebar, I am trying to display social share links in a div(.item .details .post-meta), when the main div(#sidebar .recent-post-thumb li) is hovered. I've kind of got it working, except the div(.item .details .post-meta) appears in the box below the hovered box.
Here's the css script I have added to get it to work. But, I need help figuring out why it's displaying in the box below and not the box being hovered..?
.item .details .post-meta { display:none; }
sidebar .recent-post-thumb li:first-child:hover + .item .details .post-meta {
display:block; }
sidebar .recent-post-thumb li:hover + .item .details .post-meta {
display:block; }
Any help is greatly appreciated and will teach me something new.
Upvotes: 0
Views: 761
Reputation: 864
It's because of the +
sign: it targets the next element.
Remove it and it will target the .post-meta
element inside the currently hovered li.
Upvotes: 1
Reputation: 680
#sidebar .popular-post-thumb li:hover .post-meta
is what you need for a selector instead of going to the next dom element with the +
Change sidebar .recent-post-thumb li:hover + .item .details .post-meta
to
#sidebar .popular-post-thumb li:hover .post-meta
Upvotes: 2