6

I've seen this question asked several times but haven't seen any answers.

I have a ul that I'm expanding and collapsing using slideToggle() with jquery. The code is simple:

$('#leftMenu li a.moreLess').click(function() {
    $(this).next().slideToggle('normal');   
});

With markup of:

<a class="moreLess">Click here to see more</a>
<ul>
  <li>something</li>
  <li>something else</li>
  ...
</ul>

I have a button with a class of .moreLess and when it is clicked the list below it should expand or collapse. For some reason in IE 7 all of the content is disappearing once the list is fully expanding. When it collapses, the content appears again until the list is fully closed.

I'm not sure if this is something CSS related, but I was hoping someone might have run into this before. Thanks in advance for your help!

4

4 回答 4

18

放一个zoom:1属性。它适用于位置:相对。

于 2011-11-02T09:34:54.367 回答
10

仅供参考,问题在于正在切换的 UL 内的元素上的 CSS 定位。一旦我删除了这些元素上的任何相对和/或绝对定位,问题就不再发生了。

于 2010-07-28T18:29:25.347 回答
4

放入 overflow: hidden; 您拥有内容的div,这会搞砸。对我有用,但它仍然是和 IE 错误......

于 2012-10-15T10:42:05.837 回答
0

在我的情况下,使用 slideToggle 加载的内容被“向下移动”创建 2 个空白空间(仅在 IE7 中)

我用这个CSS解决了:

form {
    margin: 0;
}
于 2013-01-14T09:12:38.073 回答