0

I have a rectangular box that can call modal when clicked. Inside the box are labels and an expand icon.

<div class="clickable-box" ng-click="openRetailerGraphDetails()" data-toggle="modal" data-target="#g-retailer-purchases-graph">
        <div class="dashboardBox clearfix">
              <div class="pull-left dashboardBoxLabel purchases">
                   <h4 class="dashboardBoxLabeltext">
                          {{RetailerPurchases}} RETAILER PURCHASES
                    </h4>
                    <span class="dashboardBoxLabel2">
                           For the current month
                    </span>
              </div>
              <img class="pull-right expand-icon" src="themes/img/dashboard/expand.svg" />
         </div>
      </div>

I want to change the opacity of the expand icon inside img tag from 0 to 0.7 when the whole clickable box is hovered. How can I achieve it?

Edit: Here`s the css

.clickable-box {
    cursor: pointer;
 }

 #dashboard .expand-icon {
    width: 20px;
    margin-top: 13px;
    margin-right: -10px;
    margin-bottom: -25px;
    opacity: 0;
  }

3 Answers 3

1

You can use the :hover pseudo class:

#dashboard .clickable-box:hover img.expand-icon {
    opacity: 0.7;
}
Sign up to request clarification or add additional context in comments.

4 Comments

Not working for me. I added more details to the question it might help you improve this answer.
where are you getting dashboard id from?
@chriscozzens the updated question, it's in the CSS there.
@chriscozzens the dashboard id is the id of the whole page. It was not included in the code I posted but you can get the idea by looking at the css code for expand-icon class :)
0
.clickable-box:hover img {
    opacity: 0.7;
}

5 Comments

Note that (almost) the same answer already posted, and your answer is missing the expand-icon class of the img tag.
Looks like he beat me by a minute! dang lol should work the same as well. Cheers.
You are welcome to upvote my answer :) regarding "should work the same" - correct, however if in the future he will add another image there - that iamge will also get that opacity on hover (and he wanted this specifically for the icon).
Not working for me. I added more details to the question it might help you improve this answer.
Please provide more detail... context... why this works outside of a css snip
0
img.pull-right.expand-icon:hover {
    opacity: 0.7;
}

CODEPEN DEMO

1 Comment

Not working for me. I added more details to the question it might help you improve this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.