如何使用jQuery将图像旋转到位? [英] How To Rotate Image In Place With jQuery?
本文介绍了如何使用jQuery将图像旋转到位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在每次点击时使图像旋转到位(图像是一个老式的电视旋钮)。尽管我付出了最大的努力,但我无法让它发挥作用。
I am trying to make an image rotate in place with each click (the image is an old-fashioned TV knob). I cannot get it to work despite my best efforts.
代码如下:
var value = 0
$("#img").rotate({
bind:
{
click: function(){
value +=90;
$(this).rotate({ animateTo:value})
}
}
} );
推荐答案
我提供了一个jsFiddle,它会在每次单击鼠标后使div旋转 。
I'm providing a jsFiddle that causes the div to rotate after every mouse click.
基本上,这是来自示例5 。 google.com/p/jqueryrotate/wiki/Examples#Example_5> jqueryrotate.js 插件。
Essentially, this is from Example 5 of the jqueryrotate.js plugin.
参考: jsFiddle
这篇关于如何使用jQuery将图像旋转到位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文