尝试在jquery中旋转按钮?

尝试在jquery中旋转按钮?,jquery,html,css,Jquery,Html,Css,我试图在jquery中旋转一个按钮 这是我在JSFIDLE上创建的 jquery代码 $("#no").rotate({ angle:0, bind: { click : function(){ var curAngle = parseInt($(this).getRotateAngle()); $(this).rotate({ angle:

我试图在jquery中旋转一个按钮

这是我在JSFIDLE上创建的

jquery代码

$("#no").rotate({ 
    angle:0,
        bind: {
            click : function(){
                var curAngle = parseInt($(this).getRotateAngle());
                $(this).rotate({
                    angle: curAngle,
                    animateTo: curAngle + 30
                });
            }
        }
   });
.rotate()
不是正式的jQuery函数,您需要手动加载它

要执行此操作,请使用以下命令引用您的应用程序:

<script type="text/javascript" src="js/jQueryRotate.2.2.js"></script>

在JSFIDLE中,我只添加了一个外部库。要查看工作情况,.

.rotate()
不是正式的jQuery函数,您需要手动加载它

要执行此操作,请使用以下命令引用您的应用程序:

<script type="text/javascript" src="js/jQueryRotate.2.2.js"></script>

在JSFIDLE中,我只添加了一个外部库。要查看工作情况,请尝试以下操作

var rotation = 0;

jQuery.fn.rotate = function(degrees) {
    $(this).css({'-webkit-transform' : 'rotate('+ degrees +'deg)',
                 '-moz-transform' : 'rotate('+ degrees +'deg)',
                 '-ms-transform' : 'rotate('+ degrees +'deg)',
                 'transform' : 'rotate('+ degrees +'deg)'});
};

$('#no').click(function() {
    rotation += 30;
    $(this).rotate(rotation);
});
检查演示

试试这个

var rotation = 0;

jQuery.fn.rotate = function(degrees) {
    $(this).css({'-webkit-transform' : 'rotate('+ degrees +'deg)',
                 '-moz-transform' : 'rotate('+ degrees +'deg)',
                 '-ms-transform' : 'rotate('+ degrees +'deg)',
                 'transform' : 'rotate('+ degrees +'deg)'});
};

$('#no').click(function() {
    rotation += 30;
    $(this).rotate(rotation);
});

查看演示

也许这对您有帮助

$("#no").rotate({ 
angle:0,
    bind: {
        click : function(){
            $(this).rotate({
                angle: 0,
                animateTo:  30
            });
        }
    }
});

查看演示:

也许这对您有帮助

$("#no").rotate({ 
angle:0,
    bind: {
        click : function(){
            $(this).rotate({
                angle: 0,
                animateTo:  30
            });
        }
    }
});

检查演示:

在fiddle中加载所需的rotate.js文件。。。它不工作,因为没有加载rotate.js..在fiddle中加载所需的rotate.js文件。。。由于未加载rotate.js,因此无法运行。。