jQuery旋转插件jqueryrotate 图片旋转
"jquery.rotate.min.js"是jQuery旋转rotate插件,支持Internet Explorer 6.0+ 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,高级浏览器下使用Transform,低版本ie使用VML实现。(不好意思,有的代码是中文字符,大家注意点,使用时改一下!)
rotate(angle)angle参数:[Number] – 默认为 0
根据给定的角度旋转图片例如:
$(“#img”).rotate(45);或 $(‘#img’).rotate({angle:45})
rotate(parameters)parameters参数:[Object] 包含旋转参数的对象。
支持的属性:
1.angle属性:[Number] – default 0 – 旋转的角度数,并且立即执行
例如:1$(“#img”).rotate({angle:45});
2.bind属性:[Object] 对象,包含绑定到一个旋转对象的事件。事件内部的$(this)指向旋转对象-这样可以在内部链式调用- $(this).rotate(…)。
例如 (click on arrow):
$(“#img”).rotate({bind:{
click: function(){
$(this).rotate({
angle: 0,
animateTo:180
})
}
}
});
3.animateTo属性:[Number] – default 0 – 从当前角度值动画旋转到给定的角度值 (或给定的角度参数)
4.duration属性:[Number] – 指定使用animateTo的动画执行持续时间
例如 (click on arrow):
$("#img").rotate({
bind:({
click: function(){
$(this).rotate({
duration:9000,
angle:0,
animateTo:360
})
}
})
});
5. step属性:[Function] – 每个动画步骤中执行的回调函数,当前角度值作为该函数的第一个参数
6. easing属性:[Function] – 默认 (see below)
默认: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 ; }
示例1:没有效果,一直转
$("#scImg").rotate({
angle:0,
animateTo:360,
callback: rotation,
easing: function (x,t,b,c,d){
return (t/d)*c ;
}
});
示例2: 默认的效果
$("#scImg").rotate({
angle:0,
animateTo:360,
callback: rotation,
easing: function (x,t,b,c,d){
return -c*((t=t/d-1)*t*t*t-1)+b ;
}
});
示例3:
$(“#img”).rotate({bind:{
click: function(){
$(this).rotate({
angle: 0,
animateTo:180,
easing: $.easing.easeInOutElastic
})
}
}
});
7.callback属性:[Function] 动画完成时执行的回调函数
例如
$(“#img”).rotate({bind:{
click: function(){
$(this).rotate({
angle: 0,
animateTo:180,
callback: function(){ alert(1) }
})
}
}
});
8. getRotateAngle这个函数只是简单地返回旋转对象当前的角度。
例如:
$(“#img”).rotate({
angle: 45,
bind: {
click : function(){
alert($(this).getRotateAngle());
}
}
});
9.stopRotate这个函数只是简单地停止正在进行的旋转动画。例如:
$(“#img”).rotate({
bind: {
click: function(){
$(“#img”).rotate({
angle: 0,
animateTo: 180,
duration: 6000
});
setTimeout(function(){
$(“#img”).stopRotate();
}, 1000);
}
}
});
最后送大家一个完整的例子
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div class="iii" style="width:500px;height:400px;background:red;" class="iii">
<img src="data:images/0.jpg" name="imge1" class="ii" alt="" />
<img src="data:images/4.jpg" name="imge1" class="i" alt="" />
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.rotate.min.js"></script>
<script type="text/javascript">
$(".iii").mouseover(function(){
$(".ii").stop().rotate({animateTo:360});
$(".i").stop().rotate({angle:0,animateTo:360});
});
$(".iii").mouseout(function(){
$(".ii").stop().rotate({animateTo:0});
});
</script>
</body>
</html>
jQuery旋转插件jqueryrotate 图片旋转的更多相关文章
- html5网页动画总结--jQuery旋转插件jqueryrotate
CSS3 提供了多种变形效果,比如矩阵变形.位移.缩放.旋转和倾斜等等,让页面更加生动活泼有趣,不再一动不动.然后 IE10 以下版本的浏览器不支持 CSS3 变形,虽然 IE 有私有属性滤镜(fil ...
- JQuery插件让图片旋转任意角度且代码极其简单 - 摘自网友
JQuery插件让图片旋转任意角度且代码极其简单 2012-04-01 09:57:03 我来说两句 收藏 我要投稿 引入下方的jquery.rotate.js文件,然后通过$ ...
- jQuery抽奖插件 jQueryRotate
实现代码 网页中引用 <script type="text/javascript" src="js/jquery.min.js"></scri ...
- JQuery插件让图片旋转任意角度且代码极其简单
引入下方的jquery.rotate.js文件,然后通过$("选择器").rotate(角度);可以旋转任意角度, 例如$("#rotate-image").r ...
- iOS开发 CGAffineTransform 让图片旋转, 旋转后获得图片旋转的角度
1.让图片旋转 UIImageView *imageView = [[UIImageView alloc]init]; imageView.frame = CGRectMake(50, 50, 200 ...
- jQuery旋转插件jquery.rotate.js 让图片旋转
演示1 直接旋转一个角度 $('#img1').rotate(45); 演示2 鼠标移动效果 $('#img2').rotate({ bind : { mouseover : function(){ ...
- JQ+rotate插件实现图片旋转,兼容IE7+ \ CHROME等浏览器
插件:/jquery.rotate.min.js CODE: <!DOCTYPE html> <html> <head> <meta charset=&quo ...
- 31.QPainter-rotate()函数分析-文字旋转不倾斜,图片旋转实现等待
在上章和上上上章: 28.QT-QPainter介绍 30.QT-渐变之QLinearGradient. QConicalGradient.QRadialGradient 学习了QPainter基础绘 ...
- jquery.lazyload插件实现图片延迟加载
jquery.lazyload是一个实现图片延迟加载的jQuery 插件,它可以延迟加载长页面中的图片.在浏览器可视区域外的图片在初始状态下不会被载入,直到用户将页面滚动到它们所在的位置. 1.引入j ...
随机推荐
- localStrorage、 sessionStorage 、cookie
HTML5中增加了两种全新数据存储方式:Web Storage和Web SQL Database. 前者可用于临时或永久保存客户端的少量数据:后者是客户端本地化的一套数据库系统,可将大量数 ...
- android工程gen目录中R.java包名是怎么确定
新建一个工程,包名用的com.mythroad.adskiller, 后来觉得不好,又改成com.mythroad.adsinscepter,但是我发现gen下的R.java文件的包名还是原来的com ...
- 七、Solr服务部署和安全
概念: 我们知道,Solr是以webapp的形式运行的,那么我们只需要把Solr.war文件部署到web容器中,便可以运行了,但是因为需要连接数据库做索引并且提供线上的服务调用query接口,那么So ...
- [Falcor] Building Paths Programmatically
model.setValue('genreList[0].titles[0].rating', 5) .then(function (value) { model.get('genreList[0.. ...
- rac 10g 加入节点具体解释
目标: 当前我环境中是有两个节点RAC1和RAC2 节点.如今添加一个RAC3节点. 概要:为现有的Oracle10g RAC 加入节点大致包含下面步骤: 1. 配置新的server节点上的硬件及 ...
- Ubunte 11.4 下安装 SSH遇到的问题
第一次安装报了一堆错,主要是也http 404 not found之类的,搜索了一番怀疑是apt的source list的问题. 网上找到一份替换之,我用的是搜狐的服务器.网址如下: http://b ...
- vs2013+EF6+Mysql
1.首先需要在整个项目中添加一个Model类库,在类库中引用EF 我需要在该项目下添加EF的MYSQL对象实体 首先需要引入几个相关引用,我通过NuGet来添加,如下图 接下来我需要通过ADO.NET ...
- (转)asp.net实现忘记密码找回的代码
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.or ...
- ORA-02095: specified initialization parameter cannot be modified
输入命令:alter system set utl_file_dir='/home/oracle/logmnr' scope=spfile; 报错: 出错原因:没有用spfile文件启动数据库 解决办 ...
- ios9基础知识总结(foundation)笔记
类:NSObject .NSString.NSMutableString.NSNumber.NSValue.NSDate.NSDateFormatter.NSRange.Collections:NSS ...