Make anything barrel roll

Takeaway: If you type “do a barrel roll” into Google, the page rotates. That’s nice but with this one-liner we can do it on any site we wish.

The online universe is falling all over itself this morning with news that Google can rotate a page.

While that’s nice, let’s do it to any page we want. After you load a page, copy and paste the following code into the address bar:

javascript:function rotateit(x){x = parseInt(x);document.body.setAttribute('style', ' -moz-transform: rotate('+x+'deg); -moz-transform-origin: 50% 50%; -webkit-transform: rotate('+x+'deg); -webkit-transform-origin: 50% 50%; -o-transform: rotate('+x+'deg); -o-transform-origin:50% 50%; -ms-transform: rotate('+x+'deg); -ms-transform-origin: 50% 50%; transform: rotate('+x+'deg); transform-origin: 50% 50%;');}for(i=0;i=360;i++){setTimeout("rotateit("+i+")",i*40);}void(0);

There we go, any page can be rotated (tested in Chrome at this point) and you can amuse your friends for a few seconds.

It turns out that since Firefox 6, pasting javascript into the address bar is not allowed — but we can get around this by creating a bookmark that does it for us.

Simply copy the code example above and paste it into the location field of a new bookmark. Add it to your bookmark bar and now you have a button that will rotate anything you like.

After testing this on Safari, it looks like Safari users are out of luck.

Article source:


Powered by Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *