簡體   English   中英

jQuery-旋轉圖像

[英]jQuery - Rotate image

我試圖創建圖像旋轉,但無法正常工作。 我嘗試了來自不同站點的不同代碼,但不知道出了什么問題。

這是我的代碼。

 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="" /> 

在您的示例中,未定義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="" /> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM