最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - rotate a html element around a point - Stack Overflow

programmeradmin1浏览0评论

How can I rotate a html element around an arbitrary point.
I know there is css rotate trasform property that rotates the element around itself. but I want to rotate it in a way like a clock needle.

How can I rotate a html element around an arbitrary point.
I know there is css rotate trasform property that rotates the element around itself. but I want to rotate it in a way like a clock needle.

Share Improve this question asked Aug 28, 2012 at 3:14 Dariush JafariDariush Jafari 5,4538 gold badges44 silver badges74 bronze badges 1
  • 1 Exact duplicate of his previous question, asked less than an hour ago. Voting to close. – Ohgodwhy Commented Aug 28, 2012 at 3:27
Add a ment  | 

3 Answers 3

Reset to default 4

You can use transform origin:

https://developer.mozilla/En/CSS/-moz-transform-origin

as mentioned here:

CSS rotation with respect to a reference point

I used the rotate to achieve this effect before. All you need to do is extend the needle png file with some transparency. Say if you have a needle with size 5x100, just make that needle to 5x200, and half of the pic is the needle, another half is transparent. then you can just rotate that image.

You're going to have to use Javascript on this one. As expected, here's a few things I found by Googling which use jQuery in particular.

  • Chris Coyier
  • Jon Combe
  • 7 others...
发布评论

评论列表(0)

  1. 暂无评论