我正在为学校建一把手风琴,我觉得它应该有效。我知道我有一切正确,直到if else声明。任何建议赞赏
$(document).ready(function () {
//
// Set up a click event handler for clicked <li>
//
$('#accordion li').click(function() {
// find first ul that is a child of this (the clicked <li>)
var $nextUL = $(this).children('ul:first-child');
// Select all siblings of the clicked <li> and then
// select any direct children <ul>'s
// that are visible - this is so we can close any visible
// <ul> before opening the <ul> for the clicked <li>
var $visibleSiblings = $(this).siblings().children('ul:visible');
// If any other <ul>s are visible, slide the visible <ul>
// up and then, after the slide up is complete, slide down
// the clicked <li>'s <ul> into view
if ($visibleSiblings.length > 0) {
$visibleSiblings.slideUp('normal', function() {
$nextUL.fadeIn('normal');
});
} else {
// either no <ul>s were open (open the clicked item)
// or the user clicked on the currently open one so close it
$nextUL.slideToggle('normal');
}
});
});
答案 0 :(得分:0)
使用Jquery fadeIn()时,持续时间没有“正常”。
$nextUL.fadeIn('normal');
参考http://www.w3schools.com/jquery/eff_fadein.asp
速度:可选。指定淡入淡出效果的速度。默认值为400毫秒 可能的值:
milliseconds
"slow"
"fast"