Rotate text using javascript

Can anyone suggest a way to rotate text from any angle without using something like Flash or Silverlight. I would like to use an oblique image with text at the same angle.

+4
source share
4 answers

A bit late, but I wrote the code for this.

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); } 

can be used with regular objects or with jQuery objects. and saves an attribute called β€œrotation” to give you the current rotation value.

+4
source
0
source

Found this jQuery jQueryRotate library that worked great for me. Note that this is not the same library as poke, although the name is very similar.

http://code.google.com/p/jqueryrotate/

0
source

Source: https://habr.com/ru/post/1302804/


All Articles