5
I need to know which id of the visible div, I’m looking for on isVisible() but it’s not working, what should I do ?
Problem:
I have several Ivs that take count of the whole screen, but I only leave visible the screen that is in question on the screen, but I need to know what id of this one. The remaining screens are property display: None;
I have by default the Divs as follows:
<div class="upage hidden background_PRINCIPAL" id="ID_ESPECIFICO_DA_DIV">
and what I’m doing is this:
if($('.upage').is(':visible') == 'home'){
}else{}
.is(':visible');
?– Sergio
I don’t know about that.
– Renan Rodrigues
@Renanrodrigues Sergio’s suggestion is correct, this is how you determine if a div is visible. But if you want to search for a visible div between a set of Divs, just use
$(":visible")
(but you probably want to filter more not to return all that is visible element in the full page, like$(".upage:visible")
).– mgibsonbr
And to get the ID of the visible div ?
– Renan Rodrigues
To catch Id do so:
$("div:visible").attr("id");
– Joao Paulo
what you are considering as Visible?
– durtto
@durtto Utilizo what is not with Hidden, the tip of our friends solved my problem and cured my doubt. Thanks to all.
– Renan Rodrigues
Yes, @Sergio’s response is very good.
– durtto