【问题标题】:directive and d3, very first transition being ignored指令和 d3,第一个转换被忽略
【发布时间】:2015-03-27 21:02:00
【问题描述】:

在一个指令中,我尝试使用 d3 应用转换(到 html 元素,而不是 SVG),但奇怪的是第一次它被忽略了。

d3.selectAll('h1')
.transition()
.duration(2000)
.style('-webkit-transform',function(d,i){
    return "translateX("+(i*30)+"px)"
})

检查此jsbin,当它最初呈现时,单击...并且元素只会跳转(没有过渡),如果在此之后的任何时间单击 - 过渡按预期工作。

我找不到解决方法

【问题讨论】:

    标签: angularjs d3.js css-transitions


    【解决方案1】:

    d3 需要第一次转换的起点:

    template: '<div style="background:red" ng-click="isTrans = !isTrans"><h1 ng-repeat="n in numbers" style="-webkit-transform: translateX(0px)"> {{n}} </h1></div>'
    

    update

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 2018-10-23
      相关资源
      最近更新 更多