我想获得几个div来响应我的mouseOver和mouseOut。我正在尝试构建类似于Vimeo风格的音量栏。JQuery:将div返回初始高度
我得到了对mouseOver作出反应的条形图,但我希望它们在mouseOut后返回到原始高度。每个酒吧是不同的高度。它在硬编码时起作用,但我试图尽可能少地使用代码。
这里是我的JQuery:
$(document).ready(function() {
var totalHeight = '100%';
var initHeight;
function getHeight(h) {
initHeight = h;
//alert(initHeight);
}
$("div#barWrap").children().mouseover(function() {
// This is where I am having trouble. I want to get the original height of the bar so I can reuse it on mouseOut
getHeight($("div#barWrap").children().css('height'));
// Animate bar
$(this).animate({ height: totalHeight}, 100);
});
$("div#barWrap").children().mouseout(function() {
$(this).animate({ height: initHeight}, 400);
});
});
任何帮助将不胜感激。
这个固定的问题!非常感谢! – joolz84 2011-06-08 00:47:28