クリックで回転する単純な画像を取得しようとしています。これは複数の画像に適用されるため、$(this)
jQuery 内でタグを使用する必要があります。私はこれを試しましたが、うまくいきませんでした:
$('.image').click(function(){
$(this).rotate(180);
});
デモhttp://jsfiddle.net/v6xtG/1/
IE8 のサポートが必要なため、CSS3 クラスを追加したくありません
クリックで回転する単純な画像を取得しようとしています。これは複数の画像に適用されるため、$(this)
jQuery 内でタグを使用する必要があります。私はこれを試しましたが、うまくいきませんでした:
$('.image').click(function(){
$(this).rotate(180);
});
デモhttp://jsfiddle.net/v6xtG/1/
IE8 のサポートが必要なため、CSS3 クラスを追加したくありません
jqueryにはすぐに使用できるrotateと呼ばれるメソッドがないため、おそらくjqueryrotateプラグインを含める必要があります。
https://code.google.com/p/jqueryrotate/downloads/detail?name=jQueryRotate.js
使用するtransform:rotate(180deg)
$('.image').click(function(){
$(this).css("transform","rotate(180deg)");
});
jqueryrotate.js の使用http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js
Jクエリ
$('.image').click(function(){
$(this).rotate(180);
});
Jsfiddle http://jsfiddle.net/9FMks/
jQueryRotate.jsの参照を適用するか、コードで次のスクリプトを使用します。
<script type="text/javascript" src="http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js"></script>