任何人都可以建议一种在不使用 Flash 或 Silverlight 之类的情况下将文本旋转任意 Angular 方法。我想使用倾斜的图像和遵循相同 Angular 文本。
最佳答案
有点晚了,但我已经写了一些代码来做到这一点。
http://jsfiddle.net/73DzT/139/
Object.prototype.rotate = function(d) {
var s = "rotate(" + d + "deg)";
if (this.style) { // regular DOM Object
this.style.MozTransform = s
this.style.WebkitTransform = s;
this.style.OTransform = s;
this.style.MSTransform = s;
this.style.transform = s;
} else if (this.css) { // JQuery Object
this.css("-moz-transform", s);
this.css("-webkit-transform", s);
this.css("-o-transform", s);
this.css("-ms-transform", s);
this.css("transform", s);
}
this.setAttribute("rotation", d);
}
可以与常规对象或 JQuery 对象一起使用。并存储一个名为“旋转”的属性,为您提供它的当前旋转值。
关于javascript - 使用 Javascript 旋转文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2359446/