"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. TTTAttributedLabel使用介绍(转)

    TTTAttributedLabel 库地址 https://github.com/TTTAttributedLabel/TTTAttributedLabel 可以实现电话  地址  链接自动查找显示 ...

  2. HtmlParser 2.0 中文乱码问题

    对于HTMLParser 2.0 工具包我们需要修改其中的Page.java文件使其适用中文的html文件分析. 主要是把protected static final String DEFAULT_C ...

  3. Color 颜色码-英文名称-十六进制-RGB对照表

      色 英文代码 形像颜色 HEX格式 RGB格式 LightPink 浅粉红 #FFB6C1 255,182,193 Pink 粉红 #FFC0CB 255,192,203 Crimson 猩红 # ...

  4. 再探java基础——对面向对象的理解(1)

    对象 对象是人们要进行研究的任何事物,从最简单的整数到复杂的飞机等均可看作对象,它不仅能表示具体的事物,还能表示抽象的规则.计划或事件.对象具有属性和行为,在程序设计中对象实现了数据和操作的结合,使数 ...

  5. 大到可以小说的Y组合子(一)

    问:上回乱扯淡了一通,这回该讲正题了吧. 答:OK. 先来列举一些我参考过,并从中受到启发的文章. (1.)老赵的一篇文章:使用Lambda表达式编写递归函数 (2.)装配脑袋的两篇文章:VS2008 ...

  6. WEB 开发所用的网站

    常用前端手册: http://caniuse.com/ http://www.w3school.com.cn/ http://www.runoob.com/ http://www.css88.com/ ...

  7. Java线程同步与死锁认识

    讲下自己的认识,算小小的总结吧! synchroized 具有同步线程的功能,它的处理机制类似于给参数里面的对象赋一个标记值,来表明当前状态,当程序里面某个线程执行synchroized里面的代码段时 ...

  8. 重新认识Intent

    相信android开发工程师,对Intent一定不陌生,在整个开发中随时都用到了,今天我们总结一下Intent. 1. 为什么需要Intent? 在android Intent机制是协助应用间的交互与 ...

  9. iOS9新特性之UIStackView

    同iOS以往每个迭代一样,iOS 9带来了很多新特性.UIKit框架每个版本都在改变,而在iOS 9比较特别的是UIStackView,它将从根本上改变开发者在iOS上创建用户界面的方式.本文将带你学 ...

  10. css3滚动提示

    <css揭秘>书中,滚动提示的实现 <!DOCTYPE html> <html lang="en"> <head> <meta ...