网上发现一个很有意思的jQuery旋转插件,支持Internet Explorer 6.0+ 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,高级浏览器下使用Transform,低版本ie使用VML实现。
调用和方法:
rotate(angle)
angle参数:[Number] – 默认为 0 – 根据给定的角度旋转图片
例如:
1 |
$( "#img" ).rotate(45);
|
rotate(parameters)
parameters参数:[Object] 包含旋转参数的对象。支持的属性:
- angle属性:[Number] – default 0 – 旋转的角度数,并且立即执行
例如:1
$(
"#img"
).rotate({angle:45});
- bind属性:[Object] 对象,包含绑定到一个旋转对象的事件。事件内部的$(this)指向旋转对象-这样你可以在内部链式调用- $(this).rotate(…)。例如 (click on arrow):
$("#img").rotate({bind:{ click: function(){ $(this).rotate({ angle: 0, animateTo:180 }) } } });
- animateTo属性:[Number] – default 0 – 从当前角度值动画旋转到给定的角度值 (或给定的角度参数)例如: 结合上面的例子,请参阅使用。
- duration属性:[Number] – 指定使用animateTo的动画执行持续时间例如 (click on arrow):
$("#img").rotate({bind:{ click: function(){ $(this).rotate({ duration:6000, angle: 0, animateTo:100 }) } } });
- step属性:[Function] – 每个动画步骤中执行的回调函数,当前角度值作为该函数的第一个参数
- easing属性:[Function] – 默认 (see below) – Easing function used to make animation look more natural. It takes five parameters (x,t,b,c,d) to support easing from http://gsgd.co.uk/sandbox/jquery/easing/ (for more details please see documentation at their website). Remember to include easing plugin before using it in jQueryRotate!Default function:
function
(x, t, b, c, d) {
return
-c * ((t=t/d-1)*t*t*t - 1) + b; }
Where:t: current time,
b: begInnIng value,
c: change In value,
d: duration,
x: unused
No easing (linear easing):function
(x, t, b, c, d) {
return
(t/d)*c ; }
Example (click on arrow):
$("#img").rotate({bind:{ click: function(){ $(this).rotate({ angle: 0, animateTo:180, easing: $.easing.easeInOutElastic }) } } });
- callback属性:[Function] 动画完成时执行的回调函数例如 (click on arrow):
$("#img").rotate({bind:{ click: function(){ $(this).rotate({ angle: 0, animateTo:180, callback: function(){ alert(1) } }) } } });
getRotateAngle
这个函数只是简单地返回旋转对象当前的角度。
例如:
1 $("#img").rotate({ 2 angle: 45, 3 bind: { 4 click : function(){ 5 alert($(this).getRotateAngle()); 6 } 7 } 8 });
stopRotate
这个函数只是简单地停止正在进行的旋转动画。
例如:
1 $("#img").rotate({ 2 bind: { 3 click: function(){ 4 $("#img").rotate({ 5 angle: 0, 6 animateTo: 180, 7 duration: 6000 8 }); 9 setTimeout(function(){ 10 $("#img").stopRotate(); 11 }, 1000); 12 } 13 } 14 });
用这个可以实现很多关于旋转的网页特效,我用这个做了个抽奖大转盘,效果不错,就是没flash顺畅,基本能跑哈哈。
jqueryrotate项目地址:http://code.google.com/p/jqueryrotate/
代码示例:http://code.google.com/p/jqueryrotate/wiki/Examples
此文转自www.css88.com 这个网站很不错的!
相关推荐
jQuery旋转插件jqueryrotate是一款jquery.rotate旋转插件。
js旋转插件jquery.rotate
jquery旋转插件rotate,方便,实用,易上手; jquery旋转插件rotate,方便,实用,易上手; jquery旋转插件rotate,方便,实用,易上手; jquery旋转插件rotate,方便,实用,易上手;
跨浏览器控制图片旋转jquery插件jquery.rotate.js.zip 跨浏览器控制图片旋转jquery插件jquery.rotate.js.zip 跨浏览器控制图片旋转jquery插件jquery.rotate.js.zip
jqueryrotate--jQuery旋转插件及案例,内含案例和js,拿去就能用,一看就懂jquery的旋转特效
NULL 博文链接:https://evoleht.iteye.com/blog/1903031
jquery rotate图片旋转插件制作转盘360度旋转抽奖代码.zip
jQuery旋转插件jqueryrotate是一款jquery.rotate旋转插件。
jQuery旋转风格切换的图片展示,点击控制按钮后,图片以旋转的方式切换至下一张,上一张自然消失,换一换形式,或许会让访客耳目一新。本效果基于jquery的旋转插件jquery.rotate.js实现。
jquery-旋转使用 CSS 3 转换的非常轻量级的 jquery 旋转插件安装 bower install jquery-rotate用法 $ ( '#element' ) . rotate ( 90 ) ; // rotate element to 90 degrees$ ( '#element' ) . rotate ( ) ; // random...
网上发现一个很有意思的jQuery旋转插件,支持Internet Explorer 6.0+ 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,高级浏览器下使用Transform,低版本ie使用VML实现,感兴趣的朋友可以了解下
这是一款用jquery.rotate.js旋转插件实现的动画效果,很不错 懒人站长推荐下载使用 使用方法: 1、将css样式引入到你的网页中 2、将body中的代码部分拷贝到你需要的地方即可 (js、图片采用绝对...
旋转切换的焦点图,基于jquery.rotate插件实现。在图片的两侧有左右控制的按钮,点击按钮后图片就切换,唯一不足的是不能自动切换,切换的方式是淡入淡出。如果你还对jquery.rotate.js用法不太熟悉的话,你可以下载...
本焦点图效果是由jQuery插件中的jquery.rotate.js 实现的旋转切换的幻灯效果,在主图的两侧有左右控制的按钮,点击按钮后图片就切换,切换的方式是淡入淡出。如果你还对jquery.rotate.js用法不太熟悉的话,你可以...
dopelessRotate是一款基于jQuery的图片旋转插件,这款图片旋转插件功能非常强大,它不仅可以在加载的时候显示进度条,而且点击右侧的放大镜按钮可以查看原始大图,并且可以滑动鼠标来漫游大图的每一个细节。...
以旋转方式切换图片的jquery图片展示,采用了一个jquery中的专用的旋转插件:jquery.rotate.js,旋转效果流畅自然,图片两侧显示控制按钮,可上一张、下一张切换,这款图片切换可用于图片网站、摄影网站、产品网站中...
jQuery旋转 添加旋转CSS属性和动画的简单插件 用法 $('。selector')。css('rotate',45); $('。selector')。animate({rotate:'360'},2000); 演示版 执照 根据 版权所有(c)2011-2013