1

I am trying to calculate the innerwidth of jquery dialog (ui-1.8)

For somereason it is always returning 0. One reason perhaps is that the dialog is still hidden and not open??

Was using

 $('#dialogId').innerwidth()

Any help?

user234267
  • 21
  • 3

2 Answers2

0

Give this method a shot, from SO post. It worked for me in past: jQuery - Get Width of Element when Not Visible (Display: None)

You set the visibility to hidden and display to block, then check width then revert.

Community
  • 1
  • 1
Dustin Laine
  • 37,935
  • 10
  • 86
  • 125
  • tried this... does not work... tried the swap function also which is mentioned in the page where your link refers... but no luck Isn't there anything specific just to the dialog api, which could be helpful... because this line does give me the width -> $('#selector').dialog( "option", "width" ) even when it is hidden,...and I need the innerwidth – user234267 Apr 05 '10 at 19:27
0

Seems like you are correct. innerWidth() in fact changes according to the element visibility.

Check this example

Pablo Fernandez
  • 103,170
  • 56
  • 192
  • 232