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 ...
随机推荐
- DevExpress之列表控件
listBoxControl和checkedListBoxControl 常用属性 DataSource---------数据源 DisplayMember-----默认显示成员 这两个属性是list ...
- IIS7.0 Windows Server 2008 R2 下配置证书服务器和HTTPS方式访问网站
配置环境 Windows版本:Windows Server 2008 R2 Enterprise Service Pack 1 系统类型: 64 位操作系统 了解HTTPS 为什么需要 HTTPS ? ...
- 一维DFT
学习DIP第3天 傅里叶变换是一个非常大的话题.今天实现了下一维的DFT,兴许将完毕其它傅里叶系的算法实现和实验. DFT公式: 当中e 是自然 ...
- IE下判断IE版本语法使用
先摆一下判断IE版本语法 <!--[if lte IE 6]> <![endif]--> IE6及其以下版本可见 <!--[if lte IE 7]> <![ ...
- 网页HTML1
表格表单 表格, <tabale> -------表格 <tr> --------------行 <td> -- ...
- html表格标签与属性
标记: 标 记 说 明 <Table> 表格标记 <Tr> 行标记 <Td> 单元格标记 <Th> 表头标记 <Table>标记属性: ...
- 移动端(IOS)iframe监听不到 onscroll 事件
问题描述: 我在一个页面A中有瀑布流,点击瀑布流中的图片需要进入到另外一个页面B,点击返回需要回到页面A中点击的位置,为了实现该效果所以在页面A中嵌入iframe,iframe指向页面B,页面B中同样 ...
- <div> 如何布局两个标签的布局
想做一个div的曾背景颜色是黄绿色,内部有<a>标签. 代码如下: <div align="center" style=" width: 900px;h ...
- MVC第一节 配置
1.View中的页面设置为起始页后导致404找不到文件. 解决方案:右键属性,把特定页置为空. 2.新建的MVC项目会把系统默认的浏览器作为浏览方式,如果想要改变的话.可以在项目中新建一个webFor ...
- Geodatabase - 打开栅格数据
打开栅格数据 和打开要素类的方式类似,打开栅格数据集需要用 IRasterWorkspace,如 //获得栅格工作空间(普通目录). public ESRI.ArcGIS.DataSourcesRas ...