我有很多东西要学,所以真的可以使用一些指针:http: //jsfiddle.net/David_Knowles/9kDC3/
问题
- 我正在尝试在条形图中迭代地存储条形的高度值。
- 然后我将所有的高度设置为零
- 然后我触发条形的动画,在其中我将高度增加到存储在数组中的原始值
问题
- 在我看来,数组正在被覆盖而不是越来越多
- 我不知道最好的方法是与我稍后触发的其他脚本共享数组值
//
$(function(){
// get the height of all the bars
var $theBars = $("#v-bars").children();
var BarsHeight = $theBars.each(function(index, element ) {
var origHeight = [];
origHeight.push($(this).attr("height"));
console.log (origHeight);
});
//
$("#svg-skills-expertise").click(function() {
$($theBars).each(function(){
$(this).css("MyH",$(this).attr("height")).animate(
{
MyH:400 // this value needs to be the array values so how
},
{
step:function(v1){
$(this).attr("height",v1)
}
})
})
console.log ("Yeap the clicked it! callback");
});
});