jquery UI 手风琴填充空间的问题
我在div容器中有一个具有手风琴效果的div,我想要手风琴div填充容器div
所以我从下载演示中学习使fillSpace:true,到容器div,我写:
.resizable({
resize: function () {
$(".accordion").accordion("resize");
});
容器还添加一些 jquery ui 类,例如 "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"
但当我拖动并调整容器大小时,问题发生了,无论变长还是变短,内部的手风琴都只会变长,
那么如何解决这个问题呢? 这是网上案例
谢谢
I have a div with accordion effect in a div container,I want the accordion div fill full of the container div
So I learn from the download demo make the fillSpace: true,to the container div,I write:
.resizable({
resize: function () {
$(".accordion").accordion("resize");
});
as well the container add some jquery ui class like "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"
but the problem happened,when I drag and resize the container,no matter the longer or the shorter,the inner accordion only become longer,
So how can I solve this problem? here is the online case
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几个问题。正如已经提到的,当您调整 portlet 的大小时,标题的大小不会正确调整。这是因为标题的宽度是固定的。使用 100% 宽度,如下所示:
主要问题是,当您调整大小时,portlet-content div 的大小不会调整,而只会调整主 portlet 的大小。因此,当您要求手风琴调整大小时,容器实际上并没有变大。您需要使 portlet-content 填充 portlet div。如果这样做:
内容 div 高度将等于门户 div 高度,这是不正确的(因为它不会考虑标题的大小)。
以下是 JavaScript 中调整 portlet-content div 大小的解决方案:
如果您只想在调整大小操作完成时自动调整大小,则还可以使用“stop”事件而不是“resize”。
There are a couple of problems. As already mentioned, the header is not resized properly when you resize the portlet. This is because the header has a fixed width. Use 100% width as follows:
The main problem is that when you are resizing, the portlet-content div is not resized, only the main portlet one. So, when you ask the accordion to resize the container isn't really any larger. You need to make the portlet-content fill the portlet div. If you do this:
The content div height will be equal to the portal div height, which is not correct (as it would not take into account the size of the header).
Here is a solution in JavaScript that resizes the portlet-content div:
You could also use the "stop" event rather than "resize" if you only want the auto-size to occur when the resize operation is complete.