Home > DeveloperSection > Forums > How to get .outerHeight of element if visible
Tanuj Kumar

Total Post:134

Posted on    February-01-2015 10:18 PM

 JavaScript JQuery 

 1 Reply(s)
 545  View(s)
Rate this:

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 ?

Ankita Pandey
Ankita Pandey

Total Post:183

Posted on    February-01-2015 10:40 PM

What about the visible selector?

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

var viewItemHeight = $viewItem.outerHeight(true);

Don't want to miss updates? Please click the below button!

Follow MindStick