David
David

Reputation: 17

Why hover has no effect?

I tried all methods but none worked, I also treid jQuery hover() function but did not work either.

The html code:

<div class="current_acticity">
    <div class="img_slides">
        <div id="img_right">
            <img src="./support_files/current_activity/1.jpg"></img>
        </div>
        <div id="img_middle">
            <img src="./support_files/current_activity/2.jpg"></img>
        </div>
        <div id="img_left">
            <img src="./support_files/current_activity/3.jpg"></img>
        </div>
    </div>
</div>

I set the opacity of img to 0.4, I try to realize that when the mouse hover to the img, set its opacity to 1.

Here are my css styles:

.current_acticity{
        width: 100%;
        height: 450px;
    }

.img_slides{
    position: absolute;
    width: 100%;
    height: 450px;
    z-index: -5;
    overflow-x: hidden;
    overflow-y: hidden;
}

.img_slides div{
    position: absolute;
    border: none;
    overflow-x: hidden;
    overflow-y: hidden;
    height: 450px;
    width: 100%;
}

.img_slides img{
    position: absolute;
    height: 100%;
    width: 100%;
    overflow: hidden;
    opacity: 0.4;
}

.img_slides img:hover{
    opacity: 1;
}

Upvotes: 1

Views: 74

Answers (1)

epascarello
epascarello

Reputation: 207501

The issue is the z-index: -5; Set it to a positive value and the hover will work.

Upvotes: 5

Related Questions