这是评论的JSfiddle。我试图使用jquery动画div的高度,这会修改css。但是,由于该项目的动态特性,高度将是未知的,并且可以找到变量。
$('span').hide();
$('.span3').click(function() {
var pollheight = $(this).find('span').height().toString(); //Trying to increase the DIV += this height (actually trying to toggle it but i'll hit that bridge later.
//$(this).find('span').append(pollheight);
$(this).animate({height: '+=80'},1000); //Trying to replace +=80 with a variable
$(this).find('span').toggle(1000);
});
答案 0 :(得分:1)
$(this).animate({height: '+=' + pollHeight},1000);
这应该可以解决问题。