I have a image-slider that slides a div with a new image in and sets the css attributes of the new div to display:block; and z-index:5;. It also sets the divs with the images that are not visible to display:none; and z-index:0;
I now want to add a class only to the current image-div that meets the condition z-index:5;
I have tried the following code but $(this) is not working and i dont have a clue how to only add a class that currently meets the condition.
if ($(".slides_control").children().css( "z-index", "5" )){
$(this).addClass("test");
} else{
$(this).removeClass("test");
}
<div class="slides_control">
Container div
<div>div with the first image</div>
<div>div with the second image</div>
<div>div with the second image</div>
</div>