Jquery/JS 隐藏元素尺寸/位置 - 使用手风琴和 AJAX :(
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
可以是可见的也可以是隐藏的(以节省空间) 无论手风琴的哪一部分展开以及#showhide
是可见还是折叠,如何获取#usertext
的尺寸?
jquery 的 .width()
不会返回隐藏元素的值。我可以设置 display:block
但页面上有很多元素,并且我在 async
JS post 中发送维度,我无法协调显示元素和获取的时间它的尺寸。我不想进入sync
,因为页面会冻结很长时间。
有什么建议吗?
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 are 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这个插件可以帮助你: http://plugins.jquery.com/project/evenIfHidden
Maybe this plugin could help you: http://plugins.jquery.com/project/evenIfHidden