我有一个搜索功能加载结果与阿贾克斯,并显示使用幻灯片动画效果。很棒!但不幸的是,第一次不幸的是,第二次(以及之后)的下滑动画不起作用。具有高度修复jQuery UI的幻灯片动画只适用首次
请看看这里: http://jsfiddle.net/e4sQh/4/
搜索is'nt进行那里,没有AJAX加载数据,但你明白了吧。谢谢你的帮助!
我有一个搜索功能加载结果与阿贾克斯,并显示使用幻灯片动画效果。很棒!但不幸的是,第一次不幸的是,第二次(以及之后)的下滑动画不起作用。具有高度修复jQuery UI的幻灯片动画只适用首次
请看看这里: http://jsfiddle.net/e4sQh/4/
搜索is'nt进行那里,没有AJAX加载数据,但你明白了吧。谢谢你的帮助!
这是因为你的高度设置为0
是您的if
检查内(这是唯一真正的第一次)位置:
// get the original height
if(!height){
// get original height
height = $el.show().height();
// update the height
$el.data("originalHeight", height);
// if the element was hidden, hide it again
if(!visible) $el.hide().css({height: 0});
}
它需要这样的外移:
// get the original height
if(!height){
// get original height
height = $el.show().height();
// update the height
$el.data("originalHeight", height);
}
// if the element was hidden, hide it again
if(!visible) $el.hide().css({height: 0});
这样,它隐藏每时间适当,you can test it out here。
更换
slideToggle('#results',true); // inside hideLoading()
与
content.slideDown();
我觉得这部分是错误的
if(!height){
// get original height
height = $el.show().height();
// update the height
$el.data("originalHeight", height);
// if the element was hidden, hide it again
if(!visible) $el.hide().css({height: 0});
}
您展示元素来获得它的高度,所以它不会滑动,因为它是看得见!
您应该使用css()
方法来设置position:absolute
,visibility:hidden
和display:block
。
反正jQuery提供方法,取代你的功能,看看上slides
完美,谢谢! – 2010-11-19 13:16:36