动态添加的dom css3过渡动画没有反应

但是在代码中创建 dom  后 没反应

var center = $('<div class="divCenter" style="color:'+color+'">'+n+'</div>')

$('body').append(center);

//getComputedStyle(center[0]).left //让页面从新渲染 否者不会触发 css3 的特效

center.css({"transform":translate,"opacity":"0"})

后面百度才知道要先把dom 加到 文档上 再设置 样式 (设置样式时要先执行   getComputedStyle(center[0]).left     )

随便读取一个 值就会触发重新渲染

就ok

猜你喜欢

转载自blog.csdn.net/qq_36445227/article/details/104123065
今日推荐