开发者

javascript webkitTransform style attributes not setting - scope?

开发者 https://www.devze.com 2022-12-20 04:13 出处:网络
I\'m trying to set the webkitTransform style attribute, but it\'s not setting for some reason. But there are other attributes that are successfully being set to the div.

I'm trying to set the webkitTransform style attribute, but it's not setting for some reason. But there are other attributes that are successfully being set to the div.

This doesn't work:

var cell = document.createElement("div");
var canvas = document.createElement("img");

cell.className = "baz";
cell.appendChild(canvas);

cell.style.color = "bar";

cell.style.webkitTransform = "foo"; 

alert(cell.style.webkitTransform);  //doesn't work - returns empty  
alert(cell.style.color);            //doesn't work - returns empty
alert(cell.className);              //outputs "baz" -- works as expected

This is all nested inside a somewhat complex set of functions, where the consequences of scope aren't totally clear to me, but that doesn't seem to me to have anything to do with this..开发者_JS百科.

thanks.


Try putting an actual transform on the div? Like cell.style.webkitTransform = "rotate(45deg)";

0

精彩评论

暂无评论...
验证码 换一张
取 消