具有 autoHeight=true 的 jQuery UI 手风琴在非默认窗格上有不必要的滚动条
我在使用 jQuery 手风琴时遇到问题。 当我创建一个内容窗格时,非默认窗格的内容比默认窗格多,并且 autoHeight 为 true,这在切换窗格时提供了很好的动画,但非默认窗格获得了我不想要的滚动条。
您可以通过转到 http://jqueryui.com/themeroller/ 切换到主题来查看此操作例如“Blitzer”或“Humanity”,然后打开示例手风琴的第 3 部分。 我使用的是 Safari 3.2.1 和 Firefox 3.0.8。
如果切换到 autoHeight=false,则不会发生这种情况,并且所有内容窗格都具有正确的高度,但内容窗格仅在动画结束时渲染并且看起来很奇怪,因此我必须关闭动画以避免这种奇怪的情况。
要么是我误读了某些内容,要么这是 jQuery UI 手风琴中的一个错误。 请帮我找出是两者中的哪一个(或者两者都是)。
I am having trouble with jQuery accordion. When I create a content pane where the non-default pane has more content than default pane, and autoHeight is true, this provides nice animations when switching panes, but the non-default pane gets a scrollbar which I don't want.
You can see this in action by going to http://jqueryui.com/themeroller/, switching to a theme like "Blitzer" or "Humanity", and then opening Section 3 of the example accordion. Happens to me with Safari 3.2.1 and Firefox 3.0.8.
If you switch to autoHeight=false, then this does not happen and all content panes have the correct height, but the content pane is only rendered at the end of the animation and looks strange, so I had to turn off animations to avoid this strangeness.
Either I am misreading something, or this is a bug in jQuery UI accordion. Please help me figure out which of the two it is (or maybe both).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
我尝试了几种不同的方法。 autoHeight: false 本身不起作用。 这最终对我有用:
我在具有固定宽度的 SharePoint 内容编辑器 Web 部件中使用它,这在向手风琴小部件添加内容时增加了高度问题。
I tried several different things. autoHeight: false by itself did not work. This is what finally worked for me:
I'm using this in a SharePoint content editor webpart with a fixed width, which added to the height issue when adding content to the accordion widget.
使用这个组合选项对我有用,1.jquery/ui的当前版本
using this combo options works for me, 1.current version of jquery/ui
我遇到了类似的问题,对我来说,CSS 的以下更改有效。
I faced similar problem, for me the following change in CSS worked.
如今(使用 jQuery UI - v1.8),只需 autoHeight 就足够了,不再出现滚动条。
Nowadays (with jQuery UI - v1.8), just autoHeight is enough, no more scrollbars are appearing.
使用
heightStyle: "content"
帮助解决了我的问题。参考:手风琴
Having
heightStyle: "content"
helped resolve my issue.Reference: Accordion
我知道这已经很旧了,但我遇到了这个问题并降落在这里。 可以在这里找到不会破坏动画并摆脱动画的解决方案:
http://webdevscrapbook.wordpress.com/2012/02/24/jquery-ui-unnecessary-scrollbar-in-accordion/
对于那些不想点击的懒惰的人来说,简短的回答是:
在手风琴的 CSS 中
I know this is old, but I was having this problem and landed here. A solution that doesn't break your animation and gets rid of the animation can be found here:
http://webdevscrapbook.wordpress.com/2012/02/24/jquery-ui-unnecessary-scrollbar-in-accordion/
For those lazy few who don't want to click, the short answer is:
in the accordion's CSS
试试这个
http://helpdesk。 objects.com.au/javascript/how-to-avoid-scrollbars-when-using-jquery-accordion
try this
http://helpdesk.objects.com.au/javascript/how-to-avoid-scrollbars-when-using-jquery-accordion
我从 http:// helpdesk.objects.com.au/javascript/how-to-avoid-scrollbars-when-using-jquery-accordion 上面提到的链接。 这是该文章下的评论之一。 它去掉了滚动条,但也保留了其余的 div 格式。 上面的答案可能会导致内容跨越边界流动,就像我所发生的那样。
I got this from the http://helpdesk.objects.com.au/javascript/how-to-avoid-scrollbars-when-using-jquery-accordion link mentioned above. It was one of the comments under the article. It gets rid of the scroll bar but also keeps the rest of the divs formatting. The above answers can cause content to flow over borders as was happening me.
这对我有用:
This works for me:
我尝试过
,但我在第一个选项卡上看到了一些视觉伪影。 所以我这样解决了这个问题:
I tried
but I saw some visual artifacts with first tab. So I fixed the problem this way:
检查 ui-accordion-content 的填充是否被覆盖。
当我将以下内容放入 css 中时,我遇到了同样的问题:
我将其更改为如下所示,并且滚动条消失了!
我也没有打开自动高度。
Check if the padding for the ui-accordion-content is being overridden.
I experienced the same issue when I had put the following in my css:
I changed it as shown below and the scroll bars were gone!
I don't have auto-height turned on either.