问题
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?
回答1:
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.
Here's the working version, the only change is making the element's blocks, <div>
elements in this case.
These:
<span id="in-the-classroom" class="menu-pane">
//and
<span id="outside-the-classroom" class="menu-pane">
Should be:
<div id="in-the-classroom" class="menu-pane">
//and
<div id="outside-the-classroom" class="menu-pane">
And of course the matching </span>
to </div>
changes.
回答2:
Try changing this:
if (cfe.active_menu_pane !== null)
to
if (cfe.active_menu_pane != null) // Remove the second equal sign
Not sure it would matter but it was the one irregularity I saw in a function.
来源:https://stackoverflow.com/questions/3835658/jquery-slideup-not-working-in-chrome