Lets take following example
A Parent div is hidden and there is a txtname inside it which is not visible to the viewer as its parent div is not visible and based on this you need to take a action
so now you can use this extender selector to find out this is really visible or not
$.extend(
$.expr[":"],
{
reallyhidden: function (a) {
var obj = $(a);
while ((obj.css(“visibility”) == “inherit” && obj.css(“display”) != “none”) && obj.parent()) {
obj = obj.parent();
}
return (obj.css(“visibility”) == “hidden” || obj.css(‘display’) == ‘none’);
}
}
);
$(document).ready(function()
{
if($(‘#something’).is(‘:reallyhidden’)){
alert(‘yes’);
$(‘#something’).parent().show();
}
else{
alert(‘no’);
}
});
No comments:
Post a Comment