"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 图片旋转的更多相关文章

  1. html5网页动画总结--jQuery旋转插件jqueryrotate

    CSS3 提供了多种变形效果,比如矩阵变形.位移.缩放.旋转和倾斜等等,让页面更加生动活泼有趣,不再一动不动.然后 IE10 以下版本的浏览器不支持 CSS3 变形,虽然 IE 有私有属性滤镜(fil ...

  2. JQuery插件让图片旋转任意角度且代码极其简单 - 摘自网友

    JQuery插件让图片旋转任意角度且代码极其简单 2012-04-01 09:57:03     我来说两句      收藏    我要投稿 引入下方的jquery.rotate.js文件,然后通过$ ...

  3. jQuery抽奖插件 jQueryRotate

    实现代码 网页中引用 <script type="text/javascript" src="js/jquery.min.js"></scri ...

  4. JQuery插件让图片旋转任意角度且代码极其简单

    引入下方的jquery.rotate.js文件,然后通过$("选择器").rotate(角度);可以旋转任意角度, 例如$("#rotate-image").r ...

  5. iOS开发 CGAffineTransform 让图片旋转, 旋转后获得图片旋转的角度

    1.让图片旋转 UIImageView *imageView = [[UIImageView alloc]init]; imageView.frame = CGRectMake(50, 50, 200 ...

  6. jQuery旋转插件jquery.rotate.js 让图片旋转

    演示1 直接旋转一个角度 $('#img1').rotate(45); 演示2 鼠标移动效果 $('#img2').rotate({ bind : { mouseover : function(){ ...

  7. JQ+rotate插件实现图片旋转,兼容IE7+ \ CHROME等浏览器

    插件:/jquery.rotate.min.js CODE: <!DOCTYPE html> <html> <head> <meta charset=&quo ...

  8. 31.QPainter-rotate()函数分析-文字旋转不倾斜,图片旋转实现等待

    在上章和上上上章: 28.QT-QPainter介绍 30.QT-渐变之QLinearGradient. QConicalGradient.QRadialGradient 学习了QPainter基础绘 ...

  9. jquery.lazyload插件实现图片延迟加载

    jquery.lazyload是一个实现图片延迟加载的jQuery 插件,它可以延迟加载长页面中的图片.在浏览器可视区域外的图片在初始状态下不会被载入,直到用户将页面滚动到它们所在的位置. 1.引入j ...

随机推荐

  1. c++大作业--学籍管理系统--

    1.题目描写叙述 学籍管理系统: 依据信息管理系统的业务流程.要求以及所要实现的目标,完毕下面功能: (1)建立学生档案的管理和维护.实现计算机自己主动化管理体制. (2)建立学生成绩管理机制,在计算 ...

  2. 数据库系统原理及其应用总结---ShinePans

    第一章  数据库概论 1.在数据库管理技术的发展过程中.数据库独立性最高的是"数据库系统"阶段 2.三大经典的数据结构模型是"关系.层次和网状模型" 3.单个用 ...

  3. Android之旅十八 百度地图环境搭建

    在android中使用百度地图,我们能够先看看百度地图对应的SDK信息:http://developer.baidu.com/map/index.php? title=androidsdk,它里面基本 ...

  4. Android中Context具体解释 ---- 你所不知道的Context

                                                                                                         ...

  5. 简易浏览器App webview

    使用 public class MainActivity extends Activity {     @Override     protected void onCreate(Bundle sav ...

  6. “=”号和“:”的区别,Html.Raw()的使用

    “=”号,将原封不动输出字符串到页面 “:”号:将字符串进行编码后输出到页面 public ActionResult HtmlEncodeDemo() { ViewData["strScri ...

  7. Linux命令之用户与组管理

    介绍 Linux操作系统中,任何文件都归属某一特定的用户,而任何用户都隶属至少一个用户组.用户是否有权限对某文件进行访问.读写以及执行,受到系统严格约束的正式这种清晰.严谨的用户与用户组管理系统.在很 ...

  8. MVC Controller 基类中的Request

    今天在测试自己MVC程序的时候发现之前写代码的一个BUG,需求是每个页面要获取当前URL链接中包含的城市ID,我把获取url的方法写到了Controller的基类BaseController(Base ...

  9. Linux 系统库函数coreleft 与sbrk简介

    coreleft   函数名: coreleft 功 能: 返回未使用内存的大小 用 法: unsigned coreleft(void); 程序例: #include <stdio.h> ...

  10. SqlServer 开启或关闭数据库主键自增

    可用作删除一行主键数据库,在还原数据行,或者删掉后,被伤处的主键还可以利用 --开启当前表的可复制功能,仅在当前回话中有效 SET IDENTITY_INSERT  dbo.PDAUserInfo O ...