jquery rotate
网上发现一个很有意思的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):
1
2
3
4
5
6
7
8
9
10$("#img").rotate({
bind: {
click: function () {
$(this).rotate({
angle: 0,
animateTo: 180
})
}
}
}); - animateTo属性:[Number] – default 0 – 从当前角度值动画旋转到给定的角度值 (或给定的角度参数)例如: 结合上面的例子,请参阅使用。
- duration属性:[Number] – 指定使用animateTo的动画执行持续时间例如 (click on arrow):
1
2
3
4
5
6
7
8
9
10
11$("#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:
1
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):
1
function(x, t, b, c, d) { return (t/d)*c ; }Example (click on arrow):
1
2
3
4
5
6
7
8
9
10$("#img").rotate({bind: {
click: function () {
$(this).rotate({
angle: 0,
animateTo: 180,
easing: $.easing.easeInOutElastic
})
}
}
}); - callback属性:[Function] 动画完成时执行的回调函数例如 (click on arrow):
1
2
3
4
5
6
7
8
9
10
11
12
13$("#img").rotate({bind: {
click: function () {
$(this).rotate({
angle: 0,
animateTo: 180,
callback: function () {
alert(1)
}
})
}
}
});
getRotateAngle
这个函数只是简单地返回旋转对象当前的角度。
例如:
1 |
$("#img").rotate({
|
stopRotate
这个函数只是简单地停止正在进行的旋转动画。
例如:
2 |
$("#img").rotate({
|
用这个可以实现很多关于旋转的网页特效,我用这个做了个抽奖大转盘,效果不错,就是没flash顺畅,基本能跑哈哈。
转自http://www.css88.com/archives/4519
jquery rotate的更多相关文章
- jquery.rotate.js实现可选抽奖次数和中奖内容的转盘抽奖代码
需求: 抽奖代码最多可以抽奖5次,而且,每次只会中“2000元理财金”或者“谢谢参与”,其它的不会抽中(哈哈,果然都是套路). 效果如下: 一.页面结构: ? 1 2 3 4 5 6 7 8 9 10 ...
- jQuery.rotate.js(控制图片转动)
jQuery.rotate.js笔记 1. jQuery.rotate.js是什么 一个开源的兼容多浏览器的jQuery插件用来对元素进行任意角度的旋转动画. 这个库开发的目的是为了旋转img的, ...
- jQuery.rotate.js笔记
1. jQuery.rotate.js是什么 一个开源的兼容多浏览器的jQuery插件用来对元素进行任意角度的旋转动画. 这个库开发的目的是为了旋转img的,在3.x之后的版本可能支持其它元素,但旋转 ...
- jquery+jquery.rotate实现图片旋转效果
首先要下载jquery.min.js 和jquery.rotate.js文件 1.下载地址: https://www.jb51.net/jiaoben/554113.html 2.导入文件 <s ...
- jquery.rotate.js实现旋转动画
1.页面引入jquery.rotate.js文件, 下载地址:https://files.cnblogs.com/files/zhoujl-5071/jquery.rotate.js(打开这个网址,c ...
- jquery.rotate.js可选抽奖次数和中奖内容的转盘抽奖demo
需求: 最多可以抽奖5次,而且,每次只会中“2000元理财金”或者“谢谢参与”,其它的不会抽中(哈哈,果然都是套路). 效果如下: 一.页面结构: <div class="g-cont ...
- jQuery.rotate.js参数
CSS3 提供了多种变形效果,比如矩阵变形.位移.缩放.旋转和倾斜等等,让页面更加生动活泼有趣,不再一动不动.然后 IE10 以下版本的浏览器不支持 CSS3 变形,虽然 IE 有私有属性滤镜(fil ...
- jquery.rotate.js库中的rotate函数怎么用。
rotate是jQuery旋转rotate插件,支持Internet Explorer 6.0+ .Firefox 2.0 .Safari 3 .Opera 9 .Google Chrome,高级浏览 ...
- jQuery旋转插件jquery.rotate.js 让图片旋转
演示1 直接旋转一个角度 $('#img1').rotate(45); 演示2 鼠标移动效果 $('#img2').rotate({ bind : { mouseover : function(){ ...
随机推荐
- Servlet常见错误及解决方法
常见错误及解决方法 1. 404产生的原因为Web服务器(容器)根据请求地址找不到对应资源,以下情况都会出现404的错误提示: 输入的地址有误(应用名大小写不正确,名称拼写不正确) 在web.xml文 ...
- python 根据对象和方法名,返回提供这个方法的定义的类
def find_defining_class(obj, method_name): for ty in type(obj).mro(): if method_name in ty.__dict__: ...
- topcoder SRM 591 DIV2 TheArithmeticProgression
#include <iostream> #include <cstdlib> using namespace std; class TheArithmeticProgressi ...
- 【POJ】1228 Grandpa's Estate(凸包)
http://poj.org/problem?id=1228 随便看看就能发现,凸包上的每条边必须满足,有相邻的边和它斜率相同(即共线或凸包上每个点必须一定在三点共线上) 然后愉快敲完凸包+斜率判定, ...
- 【wikioi】1250 Fibonacci数列(矩阵乘法)
http://wikioi.com/problem/1250/ 我就不说这题有多水了. 0 1 1 1 矩阵快速幂 #include <cstdio> #include <cstri ...
- 【COGS & USACO】896. 圈奶牛(凸包)
http://cojs.tk/cogs/problem/problem.php?pid=896 我的计算几何入门题... 看了看白书的计算几何部分,,恩好嘛.. 乃们都用向量!!!! 干嘛非要将2个点 ...
- CSS3选择器(一)之基本选择器
CSS的选择器,我想大家并不会陌生吧,因为天天在使用,但对于CSS3的选择器,要运用的灵活到位,我想对很多朋友还是一定的难度,特别是CSS3中的:nth选择器.那么从现在开始我们先丢开他们版本的区别, ...
- ckeditor的详细配置
CKEditor 3 JavaScript API Documentation : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.con ...
- tableviewCell折叠状态1
// // LHQReportOnTheUseOfFundsCtrl.m // 11 - 投资管理 - 李洪强 // 资金使用情况汇报 // Created by vic fan on 16/ ...
- OpenCV show two cameras 同时显示两个摄像头
用OpenCV同时显示两个摄像头的内容的代码如下: #include <iostream> #include <stdio.h> #include <tchar.h> ...