HOW TO GET .OUTERHEIGHT OF ELEMENT IF VISIBLE

Tanuj Kumar

Total Post:134

Points:940
Posted by  Tanuj Kumar
JQuery 
 797  View(s)
Ratings:
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 ?

  1. Ankita Pandey

    Post:183

    Points:1285
    Re: How to get .outerHeight of element if visible

    What about the visible selector?

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

    var viewItemHeight = $viewItem.outerHeight(true);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!