How to find HTML element(-s) with z-index
= 10 for example?
If you want to create a custom stacking order, you can use the z-index property on a positioned element. The z-index property can be specified with an integer value (positive, zero, or negative), which represents the position of the element along the z-axis.
To sum up, most issues with z-index can be solved by following these two guidelines: Check that the elements have their position set and z-index numbers in the correct order. Make sure that you don't have parent elements limiting the z-index level of their children.
Note: Z index only works on positioned elements ( position:absolute , position:relative , or position:fixed ).
In CSS code bases, you'll often see z-index values of 999, 9999 or 99999. This is a perhaps lazy way to ensure that the element is always on top. It can lead to problems down the road when multiple elements need to be on top.
One possible [jQuery] solution:
$(".elementsToSearch").each(function()
{
if($(this).css('z-index') == 10)
{
//then it's a match
}
});
Just loops through elements searching for a match to the css rule.
You can get all elements and filter them by css property:
$('*').each(function(){
if($(this).css('z-index') == 10) {
//$(this) - is element what you need
}
});
You have to iterate over all elements and check their z-index:
$('*').filter(function() {
return $(this).css('z-index') == 10;
}).each(function() {
// do something with them
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With