The dynamically added dom css3 transition animation does not respond

But nothing happens after creating dom in the code

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

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

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

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

Later, Baidu knew that it was necessary to add dom to the document before setting the style (when setting the style, first execute    getComputedStyle(center[0]).left     )

Reading a value randomly will trigger a re-rendering

 

Just ok

 

 

 

Guess you like

Origin blog.csdn.net/qq_36445227/article/details/104123065