jQuery旋转div [英] Jquery rotate a div
本文介绍了jQuery旋转div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法旋转div.控制台中没有警告或错误.
I am unable to rotate a div. There are no warnings or errors in console.
您可以在此处查看 JSFiddle版本.
我正在使用的代码是-
$("#div2").click(someFunction2);
function someFunction2() {
$("#div2").animate({
rotate: '+=-40deg'
}, 0);
}
我在做什么错了?
推荐答案
您可以尝试添加一些具有css3.0属性的css类:
You can try adding some css classes with css3.0 properties instead:
.box_rotate {
-webkit-transform: rotate(7.5deg); /* Chrome, Safari 3.1+ */
-moz-transform: rotate(7.5deg); /* Firefox 3.5-15 */
-ms-transform: rotate(7.5deg); /* IE 9 */
-o-transform: rotate(7.5deg); /* Opera 10.50-12.00 */
transform: rotate(7.5deg); /* Firefox 16+, IE 10+, Opera 12.50+ */
}
.box_transition {
-webkit-transition: all 0.3s ease-out; /* Chrome 1-25, Safari 3.2+ */
-moz-transition: all 0.3s ease-out; /* Firefox 4-15 */
-o-transition: all 0.3s ease-out; /* Opera 10.50–12.00 */
transition: all 0.3s ease-out; /* Chrome 26, Firefox 16+, IE 10+, Opera 12.50+ */
}
jQuery:
function someFunction2() {
$(this).addClass('box_rotate box_transition');
}
这篇关于jQuery旋转div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文