Reputation: 52551
Zepto does not support jQuery's .is(':visible')
technique.
So how do you check if an element is visible?
Upvotes: 2
Views: 5350
Reputation: 21
Zepto has some official extensions. You can include selector module to enable .is(':hidden')
Upvotes: 2
Reputation: 3224
I'm not too familiar with Zepto, however I would imagine you could just use basic JavaScript to do some form of detection:
function isVis(ele) {
if(ele.css('display')!='none' && ele.css('visibility')!='hidden' && ele.height()>0) {
return(true);
} else {
return(false);
}
}
Then in use:
var div=$('#div_id');
if(isVis(div)) {
// Element is visible
} else {
// Element in not visible
}
Upvotes: 1
Reputation: 11588
How about
.css('display') === 'block'
or, as minitech suggested:
.css('display') !== 'hidden'
If you really need to use these pseudo-selectors, you can always implement them manually.
Upvotes: -1
Reputation: 225074
I've never used Zepto, but:
.css('display') !== 'none'
would probably work. Here's a demo.
Upvotes: 10