Rotate multiple images in a circle using jquery

假装没事ソ 提交于 2019-12-04 09:38:54

Check this example

It has two items which is rotating on same orbit at same speed. It will never overlap.

EDIT:

And here is the example for 4 items to be rotated at same speed and same orbit but equally separated.

To add more items, just tweak the code by adding different angle to it.

UPDATE:

And here is the simple image version

Hope this will help. Cheers !!!

Your code works, though it looks like you had a syntax error; your first moveit call was not properly ended.

This one has same orbit, different speeds http://jsfiddle.net/thinkingsites/FyMCc/

EDIT

Your error was putting the command to rotate both of items in the same function. They both grabbed the same top and left and were always mutually bound, not to mention they both called moveit() so for every time moveit was called, it would be called twice more internally.

I've fixed your recursion so it only happens once, and made moveit accept the target element as well as a different starting position (shift).

This one has same orbit, same speed, different locations http://jsfiddle.net/thinkingsites/QAT7C/11/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!