HTML
<div id='accordion'>
<h5>Header 1</h5>
<ul>
<li>section 1 content visible</li>
<li>
<div id=showhide>
<textarea id=usertext>
user entered text here,scalable
</textarea>
</div>
</li>
</ul>
<h5>Header 2</h5>
<ul>
<li>section 2 content 1</li>
<li>section 2 content X</li>
</ul>
</div>
#showhide
can be either visible or hidden (to save space)
How to get dimensions of #usertext
regardless of which section of accordion is expanded and whether #showhide
is visible or collapsed?
jquery's .width()
does not return value for hidden elements. I could potentially set display:block
but there a开发者_StackOverflowre a lot of elements on the page and I send dimensions in async
JS post, I cannot coordinate the timing of showing elements and getting its dimensions. I don't want to go to sync
since page will freeze for a long time.
Any suggestions?
Maybe this plugin could help you: http://plugins.jquery.com/project/evenIfHidden
精彩评论