jQuery slideToggle跳来跳去 [英] jQuery slideToggle jumps around

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

问题描述

我正在网站上使用jQuery slideToggle函数来揭示有关某事的更多信息".当我触发幻灯片时,内容会逐渐显示出来,但位于右边约100个像素,直到动画突然跳到正确位置为止.反之,在开始隐藏"动画之前,内容会以相同的量向右跳,然后逐渐隐藏.

I'm using the jQuery slideToggle function on a site to reveal 'more information' about something. When I trigger the slide, the content is gradually revealed, but is located to the right by about 100 pixels until the end of the animation when it suddenly jumps to the correct position. Going the other way, the content jumps right by the same amount just before it starts its 'hide' animation, then is gradually hidden.

出现在IE7/8,FF,Chrome上.

Occurs on IE7/8, FF, Chrome.

关于如何解决此问题的任何想法?

Any ideas on how I would fix this?

谢谢.

推荐答案

我找到了一种解决方法,但是我仍然不确定细节.似乎当jQuery添加"overflow:hidden"样式时,附近的float元素的效果已改变.解决方法是在slideToggle的div上放置一个永久性的溢出:隐藏",并在左边留负的边距以抵消效果.

I have found a workaround, but I'm still not sure of the details. It seemed that when the 'overflow: hidden' style was added by jQuery, the effect that a nearby floated element had changed. The workaround was to place a permanent 'overflow: hidden' on the slideToggle'd div, and also a negative margin-left to counterbalance the effect.

令我感到惊讶的是,更改溢出值会对版面产生如此影响,但是您已经拥有了...

I am surprised that changing the overflow value has such an effect on layout, but there you have it...

这篇关于jQuery slideToggle跳来跳去的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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