jQuery SlideToggle 不适用于 IE8
我有一个代码该幻灯片切换列表项的内容。它在 FF 中工作正常,但在 IE8 中,当单击该项目时,它不是幻灯片显示内容,而是始终显示内容并向上滑动以隐藏它。 这是列表的代码:
<ul class="accordion">
<li>
<h4 class="head">Title 1</h4>
<p>Content 1.</p>
</li>
<li>
<h4 class="head">Title 2</h4>
<p>Content 2.</p>
</li>
</ul>
这是 JS/jQuery 代码:
$(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().slideToggle(250);
return false;
}).next().hide();
});
这是在线页面: http ://grupoautolider.com.ar/galeria/cabriolet
这很奇怪,因为这段代码出现在 jQuery UI 的文档页面中。必须注意的是,这在 IE7 中不会发生。我将非常感谢您的回答。提前致谢。
Possible Duplicate:
Jquery slideToggle problem in IE8 only using lists
I have a code that slideToggles the contents of list items. It works fine in FF but in IE8 when clicking the item, instead of slide show the content, it always shows the content and slides up to hide it.
Here is the code of the list:
<ul class="accordion">
<li>
<h4 class="head">Title 1</h4>
<p>Content 1.</p>
</li>
<li>
<h4 class="head">Title 2</h4>
<p>Content 2.</p>
</li>
</ul>
This is the JS/jQuery code:
$(document).ready(function(){
$('.accordion .head').click(function() {
$(this).next().slideToggle(250);
return false;
}).next().hide();
});
And here is the online page: http://grupoautolider.com.ar/galeria/cabriolet
This is strange because this code is featured in jQuery UI's doc page. It must be noted that this doesn't happen in IE7. I would be very grateful for your answers. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您正在谈论这里提到的问题: slideToggle导致 IE8 中的边距消失
只需将溢出:隐藏给边距消失的 div 即可解决。请检查..
I guess you are talking about the problem as mentioned here : slideToggle causes margin to disappear in IE8
just giving overflow:hidden to the divs where margin is disappearing would solve it. please check..