Reputation: 22652
I need to set the table cell width as 300 as shown in http://jsfiddle.net/Lijo/Q3pa2/3/. But I have a requirement to hide the table till the last line of jQuery is executed. The last jQuery task is to set the display as inline for the div. For this, I have a script as shown in http://jsfiddle.net/Lijo/Q3pa2/2/. In this fiddle, it is not working properly.
I think, the reason is, the div should be disaply:inline before taking the width of table. Is there a workaround to get/set the width of table before the table is displayed?
REFERENCE:
Upvotes: 0
Views: 407
Reputation: 12753
You'll need to quickly show it, get/set the width, then hide it. The user won't see this flicker though, the browser won't have time to render it, this is a common trick to solve your problem. You can't get the width of hidden things.
Your example http://jsfiddle.net/v6P65/
Upvotes: 1