1

I am having a problem implementing the following code. I want to affect an element by hovering another element. This is my code.

<div class="banner">
    <div class="first">
            <a href="Http://www.nytimes.com"><b>T</b></a>
    </div>
    <div class="second">
        <ul class="navigation" style="; border-radius: 10px; ">
            <p style="display: inline"  id="hp">
                <a href="http://www.nytimes.com">Go Back To Home</a>
            </p>
            <li><a href="http://www.somelink.com">Women Fashin</a></li>
            <li><a href="http://www.somelink.com">Men fashion</a></li>
        </ul>
    </div>
</div>

I want to affect #hp by hovering .first. How can I achieve this result ?

2 Answers 2

5

You can use General sibling selector ~

.first:hover ~ .second .navigation #hp a {
  color: red;
}
<div class="banner">
  <div class="first">
    <a href="Http://www.nytimes.com"><b>T</b></a>
  </div>
  <div class="second">
    <ul class="navigation" style="; border-radius: 10px; ">
      <p style="display: inline" id="hp">
        <a href="http://www.nytimes.com">Go Back To Home</a>
      </p>
      <li><a href="http://www.somelink.com">Women Fashin</a>
      </li>
      <li><a href="http://www.somelink.com">Men fashion</a>
      </li>
    </ul>
  </div>
</div>

1

You can try like this:

<script>
 $( document ).ready(function() {
$( "div.first a" ).hover(function() {
  $( '#hp' ).fadeOut( 'slow');
});
});
</script>

Not the answer you're looking for? Browse other questions tagged or ask your own question.