![](/img/trans.png)
[英]css3 transform not rendering properly on chrome (works on firefox)
[英]css transform with multiple attributes works on firefox but not in chrome
我試圖添加樣式變換旋轉以及縮放到一組圖像。 我用了
img.style = "transform: rotate(" + object[k].angle + "deg) scale(0.2);";
使用此屬性可以在firefox中旋轉並設置樣式屬性,但是在chrome上運行時它不能工作。 所以我嘗試使用
img.style.webkitTransform = "rotate(" + object[k].angle + "deg) scale(0.2);";
在firefox和chrome中使用此功能時,僅縮放有效。 由於我對json中的不同圖像使用了不同的旋轉角度,因此很難將它們稱為stylesheet.css
這是因為字符串中的分號。 Chrome將此視為您設置的樣式的一部分,並認為它無效,因此將其忽略。 刪除它可以在Chrome中正常運行。 更改:
img.style.webkitTransform = "rotate(" + object[k].angle + "deg) scale(0.2);";
^
至:
img.style.webkitTransform = "rotate(" + object[k].angle + "deg) scale(0.2)";
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.