d3.js transition end event

前端 未结 3 730
情歌与酒
情歌与酒 2020-12-03 21:32

I am applying a transition to a group of nodes returned by selectAll(). I thought the end event would fire after all transitions finished, but each(\"end\

3条回答
  •  旧巷少年郎
    2020-12-03 21:59

    I had the same issue

    that the call back gets executed with each element

    I have solved that using underscore once method

    http://underscorejs.org/#once

    d3.select("#myid")
    .transition()
    .style("opacity","0")
    .each("end", _.once(myCallback) );
    

提交回复
热议问题