我有这个函数:
function fixedFeeSize(i){
var num1 = $('#num' + i);
if (num1.hasClass("extended")) {
num1.stop(true, true).animate({height: '59px'},500);
num1.removeClass("extended");
}else{
var height = 0;
num1.animate({height: '360px'},500);
num1.addClass("extended");
}
return null;
}它扩展/收缩了一个div,但是我正在努力让它扩展到div的高度,因为每个div (将会有10+)的高度是不同的。
我尝试了num1.animate({height: 'auto'},500);,但它不起作用。
发布于 2013-02-19 01:42:44
这就是你想要的效果吗?
jQuery(".menu a").mouseenter(function(){
jQuery(this).stop().animate({
height: 200, opacity: 0.5
}, 1000, "linear");
});
jQuery(".menu a").mouseleave(function(){
jQuery(this).stop().animate({
height: 18, opacity: 1
}, 1000, "linear");
});这里有一个jsfiddle:http://jsfiddle.net/kKAZx/1/
要进一步阅读,请查看.animate函数的完整文档:http://api.jquery.com/animate/
你可以组合特效来制作各种奇妙的、符合标准的特效。
https://stackoverflow.com/questions/14816524
复制相似问题