1

Hi I'm having problems developing with Samsung Smart TV SDK, which use javascript (I'm using JQuery for most part of code). I need to get the size of a row in a div but in Samsung TV 2011 the

$('#element').css('font-size')

and

$('#element').css('line-height')

doesn't work (it's a software problem about 2011 because in 2012 and 2013 work correctly). Anyone know how to get the size of a row in Jquery or javascript without this two methods?

Thanks in advance.

antyrat
  • 27,479
  • 9
  • 75
  • 76

2 Answers2

2

Try with outerHeight():

var height = $('#element').outerHeight();

Or maybe you are looking for innerHeight():

var height = $('#element').innerHeight();
A. Wolff
  • 74,033
  • 9
  • 94
  • 155
0

If you actually want to return the line height use this...

function getStyle(el,styleProp)
{
    var x = document.getElementById(el);
    if (x.currentStyle)
        var y = x.currentStyle[styleProp];
    else if (window.getComputedStyle)
        var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
    return y;
}

Then use it like...

getStyle('#test', 'line-height' )

From here... JavaScript: Find DIV's line-height, not CSS property but actual line-height

Community
  • 1
  • 1
recneps
  • 1,285
  • 5
  • 16
  • 27