本文介绍了jQuery .slideUp()在Chrome中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将类似手风琴的部分制作到我正在处理的页面上.我没有使用jQueries本机手风琴插件,因为我需要关闭所有部分的功能.我的问题是Chrome似乎没有响应.slideUp(),而一切似乎在Firefox和IE中都可以正常工作.而不是尝试复制我刚刚在此处上传的所有相关代码段 http://ianburris.com/p/tmp/.有任何想法可能导致Chrome出现此问题吗?

I'm trying to make an accordion like section to a page I'm working on. I'm not using jQueries native accordion plugin because I need the ability to close all the sections. My problem is Chrome doesn't seem to be responding to .slideUp() while everything seems to work perfectly in Firefox and IE. Rather than try and copy all the relative code snippets I just uploaded here http://ianburris.com/p/tmp/. Any ideas what might be causing this in Chrome?

推荐答案

您应该在容器中使用<div>而不是<span>,在这里这里是您的代码(忘记样式,只关注滑动),不能与chrome中的<span>一起使用.

You should use a <div> for your containers rather than a <span> here, here's your code (forget the styling, focus on the sliding) as it is, not working with a <span> in chrome.

这是有效的版本,唯一的变化是使元素的块,<div>元素这种情况.

Here's the working version, the only change is making the element's blocks, <div> elements in this case.

这些:

<span id="in-the-classroom" class="menu-pane">
//and
<span id="outside-the-classroom" class="menu-pane">

应该是:

<div id="in-the-classroom" class="menu-pane">
//and
<div id="outside-the-classroom" class="menu-pane">

当然,与</span>匹配的</span>也将更改.

And of course the matching </span> to </div> changes.

这篇关于jQuery .slideUp()在Chrome中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 08:37