3

I need a help. I was doing a drop up menu with share icons. My problem is this: I'd like that when I pass the mouse over the main-share icon in the footer and than go to select another icon (like facebook), the main icon remains selected like as mouse hover, but it don’t works.

<div class="footer large blue">Footer Blue
<div class="pull-right buttons">
    <ul>
        <li><a class="btn2 large share2 blue" href="#">Share</a>

            <ul>
                <li><a class="btn large rss" href="#">RSS</a>

                </li>
                <li><a class="btn large twitter" href="#">Twitter</a>

                </li>
                <li><a class="btn large plus" href="#">G+</a>

                </li>
                <li><a class="btn large facebook" href="#">Fb</a>

                </li>
            </ul>
        </li>
        <li><a class="btn2 large btt blue" href="#">Back to Top</a>

        </li>
    </ul>
</div>

I think the problem is that the elements li and a, are two independent tags.

Watch this image to understand it better what am i saying (because i’m not able to explain it better ._.)

http://db.tt/Kujz3Pv4

Here's the code: http://jsfiddle.net/zPavan/KHWJ4/2/

If there are any problems or have suggestions on the code, I thank you for the advice!

Bac0
  • 51
  • 2
  • +1 Well formed question! See [this fiddle](http://jsfiddle.net/AGgpN/3/) from [this answer](http://stackoverflow.com/a/8114664/757830). – NGLN Feb 04 '13 at 22:49

2 Answers2

4

Instead of depending on the hovering of the <a> specifically, make it depend on the list item that contains the entire <ul>:

li:hover > .btn2.blue {
    background-color: hsl(197, 59%, 30%);
}

I would suggest giving that specific li a class like .share that you can use as well.

http://jsfiddle.net/ExplosionPIlls/KHWJ4/3/

Explosion Pills
  • 176,581
  • 46
  • 285
  • 363
0

I think this will do it:

.buttons ul li:hover > a {
    background-color: #1f5f79;
} 
Diodeus - James MacFarlane
  • 107,156
  • 31
  • 147
  • 171