Masta
Masta

Reputation: 149

Div over image and mouseover event

I have a site with images and some of them have a "play" (a div positioned absolutely and managed via click event on jQuery) over it.

In some images I must to change the opacity when the mouse is over the image.

When an imagen have at same time the "play" and the opacity change, this is happening (place the mouse over the "play" div): http://jsfiddle.net/S53b5/

I have tried different solutions only CSS or using jQuery, but anything works :(

Thanks!

Upvotes: 0

Views: 295

Answers (3)

StaticVariable
StaticVariable

Reputation: 5283

$("img").mouseover(function(){
    $(this).css("opacity",".8");
})

Upvotes: 0

GajendraSinghParihar
GajendraSinghParihar

Reputation: 9131

try this demo

   $("img").mouseout(function(){
     $(".play").css("opacity","1")
    }).mouseover(function(){
     $(".play").css("opacity",".5");
    });

Updated Demo2

$("img").mouseout(function(){
        $(".play").css("opacity","1");
         $(this).css("opacity",".1");
    }).mouseover(function(){
        $(".play").css("opacity",".5");
        $(this).css("opacity","1");
    });

$(".play").mouseover(function(){
        $(this).css("opacity","1");
        $("img").css("opacity","1");
    });

Upvotes: 2

Weacked
Weacked

Reputation: 970

$("#(yourimageid)").mouseover(function(){
$(this).css("opacity","0.7")
})

Upvotes: 0

Related Questions