views:

357

answers:

1

How can one get the height of the content area in a JQuery UI tabbed panel? $('.ui-tabs-panel').height() clearly returns the height of the content area + the height of the tabs. I am assuming there must be an easy way to get this dimension? So far my searching online is not turning that answer up.

Any suggestions would be most appreciated!

Chris

A: 

You had it right:

$('.ui-tabs-panel').height() 

Gets the height of just the content panel, this doesn't include the tabs. If you did this though:

$('.ui-tabs').height()

It would include the tabs height as well.

Nick Craver
Interestingly enough, those two calls return the same result for me. And it's the dimension that includes the tab heights.
Chris
@Chris - Very odd indeed, which browser?, are you using a customized/tweaked theme? and do you have an example page by chance?
Nick Craver
Nick, Have a look at the discussion here I've been having with a fellow on the JQuery site. http://forum.jquery.com/topic/height-of-jquery-ui-tab-content-panel#14737000000822354He provided an example for discussion. I just posted a comment highlighting my issue wrt his example. I modified the height of the overall tab and then tried to get the height of the content panel. But I'm getting the height of the content present in the content panel instead. Not what I'm looking for...
Chris
Nick, Here's a link to the example Dave provided on the JQuery forum. http://jsbin.com/emera3/2I've modified it slightly with this bit of code to set the height of the tab panel to fill the display area. $(function(){ var winHeight = $(window).height(); var tabHeight = winHeight - 10; $('#tabs').height(tabHeight); }); You'll notice when you press the button at the bottom to get the dimensions that the height being reported is not the height of the tab content panel. Instead it's the height of the content present.
Chris
@Chris - Sorry I didn't get to go through pending questions until now - the explanation at the end of the jQuery thread is accurate, you're setting height on the outer div, the inner panels don't auto-expand to it's content, so that's why you're seeing those numbers.
Nick Craver