Javascript jQuery rotatable()的度数
大家好,我们使用jqueryrotatable插件来旋转divJavascript jQuery rotatable()的度数,javascript,jquery,rotation,Javascript,Jquery,Rotation,大家好,我们使用jqueryrotatable插件来旋转div $(函数(){ $('.new multiple').rotatable(); }); 。新建多个{ 显示:内联块; } 如果您在查看文档时看到: 度:以度为单位开始旋转(默认为0) 因此,您无法在尝试时使用该选项。它需要是介于0和360之间的int值,而不是true 例如,如果希望将旋转初始化为45度,可以使用: $(function() { $('.new-multiple').rotatable({ degre
$(函数(){
$('.new multiple').rotatable();
});代码>
。新建多个{
显示:内联块;
}
如果您在查看文档时看到:
度
:以度为单位开始旋转(默认为0)
因此,您无法在尝试时使用该选项。它需要是介于0和360之间的int
值,而不是true
例如,如果希望将旋转初始化为45度,可以使用:
$(function() {
$('.new-multiple').rotatable({
degress: 45
});
});
希望这会有帮助。因为我需要以度为单位获得旋转,我在停止事件中将给定弧度转换为度
$('.new-multiple').rotatable({
stop: function(e, ui){
if(ui.angle.current<0){
var given_angle=ui.angle.current+2*Math.PI;
}
else{ var given_angle=ui.angle.current; }
var new_angle=Math.round(given_angle*180/ Math.PI)+"deg";
$(".new-multiple").css("transform","rotate("+new_angle+")");
}
});
$('.new multiple')。可旋转({
停止:功能(e、ui){
如果(ui.angle.current)查看一下@matt,我不确定画布旋转与jQuery ui插件和CSS之间的关系。ui.angle.degree
为您提供了度。我将对此进行检查。这意味着$(“.new multiple”).CSS(“变换”,“旋转”(+ui.angle.degree+”)?