0
我想创建带有变量'顶部'高度的slidingUp div,以便一个div可以slideUp 700px,而另一个div(内容较少)slidesUp只有400px。目前,divs都在同一高度上滑动。在CSS中没有div高度声明。我的脚本:jquery重置和设置变量
$(document).ready(function(){
var oldHeight;
$('a.menubtn').click(function(){
var newHeight;
if ($(this.id) == 'work') {
newHeight = 700;
}
else { if ($(this.id) == 'services') {
newHeight = 400;
}
else { if ($(this.id) == 'about') {
newHeight = 400;
}
else {
newHeight = 300;
}
}
}
if ($('.active').length > 0) {
$('.active').removeClass('active').animate({'top': '+=' + oldHeight + 'px'}, '200');
$('div#contents_'+ this.id).addClass('active').animate({'top': '-=' + newHeight + 'px'}, '200');
oldHeight = newHeight;
}
else
$('div#contents_'+ this.id).addClass('active').animate({'top': '-=' + newHeight + 'px'}, '200');
oldHeight = newHeight;
}
return(false);
});
})
TIA。
唉,有什么一个愚蠢的错误!谢谢:-) – circey 2010-08-10 23:11:56
@circey - 不客气。 :O) – user113716 2010-08-10 23:18:33