JQuery缓动不起作用

时间:2016-03-16 19:25:11

标签: javascript jquery animation easing jquery-easing

尝试重新创建:

http://jsfiddle.net/pvq111u9/

它旋转360度然后停止...缓和功能没有被调用...甚至尝试过包括jquery.easing.min.js ...

<script type="text/javascript" src="http://beneposto.pl/jqueryrotate/js/jQueryRotateCompressed.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<img src="picpath" id="image">
<script type="text/javascript">
  var rotation = function (){
    $("#image").rotate({
      angle:0, 
      animateTo:360,
      callback: rotation,
      easing: function (x,t,b,c,d){
        // t: current time, b: begInnIng value, c: change In value, d: duration
        return c*(t/d)+b;
      }
    });
  }
  rotation();

2 个答案:

答案 0 :(得分:0)

您确定关闭了script代码吗?为我工作fiddle

答案 1 :(得分:0)

您需要放置图片的扩展文件,jquery库和close </script>标记,例如:

<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.1.min.js"></script>
<script type="text/javascript" src="http://beneposto.pl/jqueryrotate/js/jQueryRotateCompressed.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>


<img src="descarga.jpg" id="image">

<script type="text/javascript">
  var rotation = function (){
    $("#image").rotate({
      angle:0, 
      animateTo:360,
      callback: rotation,
      easing: function (x,t,b,c,d){
        // t: current time, b: begInnIng value, c: change In value, d: duration
        return c*(t/d)+b;
      }
    });
  }
  rotation();
  </script>