打开时 jQuery UI 手风琴跳动 [英] jQuery UI Accordion Jumpy When Opened

查看:32
本文介绍了打开时 jQuery UI 手风琴跳动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有一个手风琴小部件,它在动画打开时扩展到它应该停止的位置(在动画结束时恢复到正确的大小),并在它开始动画关闭时对齐到相同的扩展大小.就我而言,手风琴内容应该扩展到 150 像素,但我在 Chrome 的检查元素"窗口中观看了它的动画,并看到它短暂地变为 185 像素.

I have an accordion widget on my page that expands past where it should stop when animating open (snapping back to the correct size at the end of the animation), and snaps to this same extended-size when it begins to animate closed. In my case, the accordion content should expand to 150px, but I have watched it animate in Chrome's Inspect Element window and seen it go to 185px briefly.

我看到其他人表示,在将手风琴部分更改为 position: absolute 以进行大小计算时,填充和/或边距可能会愚弄 jQuery.

I have seen others suggest that padding and/or margins may be fooling jQuery when it makes a size calculation when changing the accordion section to position: absolute briefly to make the calculation.

http://jsfiddle.net/shadowycore/T5fnZ/1/

任何帮助都将不胜感激.

Any help at all would be greatly appreciated.

推荐答案

我遇到了同样的问题,几个小时后我终于设法通过添加以下 CSS 来修复它:

I had the same problem and after a few hours I finally managed to fix it by adding the following CSS:

 .ui-accordion .ui-accordion-content{
      box-sizing:content-box;             
      -moz-box-sizing:content-box;
}

希望能帮到你

这篇关于打开时 jQuery UI 手风琴跳动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆