gpt4 book ai didi

javascript - jQuery rotatable() 的度数

转载 作者:行者123 更新时间:2023-11-29 23:33:33 25 4
gpt4 key购买 nike

您好,我们正在使用 jquery rotatble 插件来旋转一个 div

$( function() {

$('.new-multiple').rotatable();
});
.new-multiple{
display:inline-block;
}
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/godswearhats/jquery-ui-rotatable@1.1/jquery.ui.rotatable.css">
<script src="https://cdn.jsdelivr.net/gh/godswearhats/jquery-ui-rotatable@1.1/jquery.ui.rotatable.min.js"></script>

<div class="new-multiple">

<img src="https://www.gravatar.com/avatar/322f808cb7a7e06d38ca4c8a441332fd?s=48&d=identicon&r=PG&f=1">
</div>

但问题是它使用 radiant option 旋转 div。但是我们需要使用 degree 旋转 div。即 0 到 360 度。我们如何实现这一点

我试过了

.rotatable({
options: {
degrees: true
}
});

但这行不通

最佳答案

如果您在 https://github.com/godswearhats/jquery-ui-rotatable 查看文档你会看到:

degrees: starting rotation in degrees (default 0)

因此,您不能像您尝试的那样使用该选项。它需要是 0 到 360 之间的 int 值,而不是 true

例如,如果您希望将旋转初始化为 45 度,您可以使用:

$(function() {
$('.new-multiple').rotatable({
degress: 45
});
});

希望对您有所帮助。

关于javascript - jQuery rotatable() 的度数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46744738/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com