How to set CSS3 transition using javascript?

后端 未结 6 718
执念已碎
执念已碎 2020-11-29 04:26

How can I set CSS using javascript (I don\'t have access to the CSS file)?

#fade div {
  -webkit-transition: opacity 1s;
  -moz-transition: opacity 1s;
  -o-         


        
6条回答
  •  独厮守ぢ
    2020-11-29 05:03

    function reg(){
    
    var style = document.head.appendChild(document.createElement("style"));
    
    style.innerHTML = "#main:after {border-right:400px solid #fde561; left:0 ; transition : 0.5s all ease}";
    
    }
    

提交回复
热议问题