如何使用 jquery 不断旋转对象?
好的!情况是这样的。我有一个 jQuery 插件,它可以在我的标题中设置背景图像的动画,以不断从左到右滚动。我在此标题上放置了一个 .png 轮子。我需要让轮子随着移动的背景不断旋转。
CSS3 - 是的,我可以使用 CSS3,但是一些使用 Internet Explorer 的可怜人会在移动的背景上看到一个固定的轮子,这会很奇怪。
jQuery 插件 - 这是我想使用的插件,但我还没有找到一个可以不断旋转图像的插件。当您激活它时,大多数只会旋转一定角度。
如果有人有任何想法,我将不胜感激!
OKAY! Here's the situation. I've got a jQuery plugin that's animating a background-image in my header to constantly scroll left-to-right. I have a .png of a wheel sitting on this header. I need to have the wheel constantly spinning with the moving background.
CSS3- Yes I could use CSS3, but then some poor soul using Internet Explorer would see a stationary wheel on a moving background which would be weird.
jQuery Plugins- This is what I'd LIKE to use, but I have yet to find one that will constantly rotate the image. Most only rotate by a certain angle when you activate it.
If anybody has any thoughts, I'd appreciate it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
@dietbacon 问如何停止轮换。由于我还不能发表评论,我就在这里回答。
在 this 答案中,我编写了一个函数,该函数在给定元素中进行无限旋转并且可以取消。
@dietbacon asked how to stop a rotation. Since I cannot yet comment, I will answer here.
In this answer, I wrote a function that does an infinite rotation in a given element and that can be cancelled.
您可以尝试以下操作:
http://code.google.com/p/jqueryrotate/wiki/Examples
You could try this:
http://code.google.com/p/jqueryrotate/wiki/Examples
查看我的帖子:
Check out my post:
它本身不是 jQuery,但如果您想在 JavaScript 中不断执行某些操作,请使用 setInterval(),如下所示:
但将警报替换为轮换代码,间隔以毫秒为单位。
It's not jQuery as such, but if you want to do something constantly in JavaScript, use
setInterval()
, like so:But replace the alert with your rotation code, and the interval is in milliseconds.
看起来您想要这个关于旋转图像的相关问题的答案使用 jQuery...
但它纯粹是一个旋转轮,那么两帧或三帧动画 gif 可能会更容易、更快、CPU 占用更少...
It looks like you want this answer to a related question about rotating images with jQuery...
But it's purely a rotating wheel, then a two or three frame animated gif will probably be easier, faster, and less CPU-intensive...
您可以使用 jquery 插件来旋转图像(如 3D 对象):
pic360 插件
You can use jquery plugin for rotating image like 3d object:
pic360 plugin
我为此创建了一个插件,它也适用于 Internet Explorer 7 和 8!
在这里:http://wp-dreams.com/jquery-element-rotation-插件/
I have created a plugin for this, which works with internet explorer 7 and 8 as well!
Here you go: http://wp-dreams.com/jquery-element-rotation-plugin/