原生JS设置CSS3样式时,怎么添加兼容性前缀(-webkit-)
大家讲道理
大家讲道理 2016-11-12 13:48:31
0
2
958

正常设置css3样式是这样的
obj.style.WebkitTransition = "all 1s linear";
解析出来的是
<div id="obj" style="transition: all 1s linear;"></div>
我想知道怎么加上-webkit-前缀。如下面
<div id="obj" style="-webkit-transition: all 1s linear;"></div>

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
代言

那个,如果你的元素没有内联样式的话,你可以直接obj.style.cssText="-webkit-transition: all 1s linear;...;"试试看

代言

你有用webpack、gulp、grunt这些工具么- -或者有编辑器吧,弄个Autoprefixer就行了- -手写很麻烦。。而且可维护性不好,以后突然其中一个前缀不需要了,你又要手动去改

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!