我正在尝试使用 jquery 获得一个元素来动画旋转悬停效果,我有这个 jsFiddle 去测试.到目前为止,我有这个:
I'm trying to get an element to animate a rotation hover effect using jquery, I have this jsFiddle going to test. So Far I have this:
$(".icon").hover(function() {
$(this).stop().animate({transform: "rotate(-90deg)", height: "200px"},400);
},function() {
$(this).stop().animate({backgroundColor : "black", color: "red"},400);
});
但它似乎根本没有旋转它,我意识到设置 css 的正确方法是:
But it doesn't seem to be rotating it at all, I realize the proper way to set the css is:
-webkit-transform: 旋转(30度);
-webkit-transform: rotate(30deg);
我试过了:
$(this).stop().animate({-webkit-transform: "rotate(-90deg)", height: "200px"},400);
但即使是高度也不会改变.任何建议都会有所帮助,谢谢!
but then even the Height doesn't change. any advice would help thanks!
链接到 JSFiddle
使用优秀的 jQuery Rotate 插件.http://code.google.com/p/jqueryrotate/.所有主流浏览器都支持它
Use the excellent jQuery Rotate plugin. http://code.google.com/p/jqueryrotate/. It is supported by all major browsers
* Internet Explorer 6.0 >
* Firefox 2.0 >
* Safari 3 >
* Opera 9 >
* Google Chrome
要旋转图像,您需要做的就是 $('#myImage').rotate(30)//用于 30 度旋转其中 #myImage 是您要旋转的元素的 id.
To rotate an image, All you need to do is $('#myImage').rotate(30) //for a 30 degree rotation
Where #myImage is the id of the element you want rotated.
要动画旋转,你可以使用 setTmeout ex:
To animate rotation, you can use setTmeout ex:
setTimeout(function() { $('#myImage').rotate(30) },5)
这篇关于在 jQuery 中转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
即使在调用 abort (jQuery) 之后,浏览器也会等待Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在调用 abort (jQuery) 之后,浏览器也会等待 ajax 调用
XMLHttpRequest 无法加载,请求的资源上不存在“AXMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 无法加载,请求的资
XMLHttpRequest、jQuery.ajax、jQuery.post、jQuery.get 有什么What is the difference between XMLHttpRequest, jQuery.ajax, jQuery.post, jQuery.get(XMLHttpRequest、jQuery.ajax、jQuery.post、jQuery.get 有什么区别
可以使用 xhrFields 将 onprogress 功能添加到 jQuery.Can onprogress functionality be added to jQuery.ajax() by using xhrFields?(可以使用 xhrFields 将 onprogress 功能添加到 jQuery.ajax() 吗?)
显示使用 XHR2/AJAX 下载文件的进度条Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
如何在没有 jQuery 的情况下在 JavaScript 中打开 JHow can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)