【发布时间】:2013-05-20 14:35:49
【问题描述】:
问题:
我正在尝试为 SVG 图形条的高度设置动画:http://jsfiddle.net/David_Knowles/pRTBt/
我的部分问题是.height() 返回0,而.attr("height") 返回真实高度。
$(function(){
var $theBars = $("#v-bars").children();
var BarsHeight = $theBars.each(function(index, element ) {
var origHeight = $(this).attr("height");
console.log( index + ": " + $(this).attr("height"));
console.log( index + ": " + $(this).height());
});
});
我计划在触发eventHander 时将高度设置为零并使用jquery.animate 为高度设置动画,但由于返回的高度问题似乎无法做到。
问题:
- 为什么
.height()返回零? - 例如,在单击时将原始高度应用回条形的最佳方法是什么?
编辑:部分解决方案 http://jsfiddle.net/David_Knowles/pRTBt/12/
可以编辑高度属性。这需要弄清楚如何将值数组传递给它
【问题讨论】:
标签: javascript html css svg jquery-animate