get .outerHeight of element if visible

330 views Asked by At

Im woundering if its possible to get .outerHeight() of element only if its is visible

I currently have

var $viewItem = $('.test').find('.item');

var viewItemHeight = $viewItem.outerHeight(true);

The problem is $viewItem

Will return two elements at a time, one will be hidden. If is possible to test and only get the height of the visible one ?

1

There are 1 answers

0
Bernhard On BEST ANSWER

What about the visible selector?

var $viewItem = $('.test').find('.item:visible');
var viewItemHeight = $viewItem.outerHeight(true);