【问题标题】:jQuery - Rotate imagejQuery - 旋转图像
【发布时间】:2016-02-14 07:48:55
【问题描述】:

我尝试创建图像旋转,但它不起作用。我尝试了不同网站的不同代码,但不知道出了什么问题。

这是我的代码。

var value = 0
$("#image").rotate({ 
  bind: 
  { 
    click: function(){
      value +=90;
      $(this).rotate({ animateTo:value})
    }
  } 
});
#image{
  margin:200px 200px; 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://cdn.sobekrepository.org/includes/jquery-rotate/2.2/jquery-rotate.min.js"></script>
<script type="text/javascript" src="http://beneposto.pl/jqueryrotate/js/jQueryRotateCompressed.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<img src="http://jqueryrotate.com/images/chrome_32x32.png" id="image" onclick="" />

【问题讨论】:

    标签: javascript jquery jquery-rotate


    【解决方案1】:

    在您的示例中,jQuery 未定义,请检查以下代码:

    var value = 0
    $("#image").rotate({
      bind: {
        click: function() {
          value += 90;
          $(this).rotate({
            animateTo: value
          })
        }
      }
    });
    #image {
      margin: 200px 200px;
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script type="text/javascript" src="include/jQueryRotate.js"></script>
    <script type="text/javascript" src="http://beneposto.pl/jqueryrotate/js/jQueryRotateCompressed.js"></script>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
    <img src="http://i.forbesimg.com/media/lists/companies/apple_416x416.jpg" id="image" onclick="" />

    【讨论】:

    • 您的代码 sn-p 在网站上可以正常工作,但在我的代码中无法正常工作..
    猜你喜欢
    • 2023-03-13
    • 1970-01-01
    • 2011-12-10
    • 1970-01-01
    • 2013-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-03
    相关资源
    最近更新 更多