CSS tranform:translateY from JavaScript

前端 未结 3 905
悲&欢浪女
悲&欢浪女 2021-02-07 11:54

How would I access and change transform: translateY(0px); using the style object from JavaScript, in a similar matter to div.style.background = 50px.

3条回答
  •  春和景丽
    2021-02-07 12:35

    Alternative solution:

    div.setAttribute('style','transform:translateY(10px)');
    

提交回复
热议问题