[jQueryRotateライブラリ] 画像を回転させる

説明

jQueryRotateライブラリで画像を回転させるには回転させる画像を指定しrotate()メソッドを実行します。パラメータに角度を指定します。正数なら時計回り、負数なら反時計回りになります。また、オプションパラメータのangleで角度を指定することもできます。他にもmaxAngle、minAngleで最大、最小回転角度を指定できます。

サンプルプログラム

【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="css/main.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jQueryRotate.js"></script>
<script type="text/javascript" src="js/sample.js"></script>
</head>
<body>
<h1>jQuery Rotateサンプル</h1>
<img src="images/sample.jpg" id="myPhoto" width="384" height="216">
</body>
</html>


【sample.js】
$(function() {
$("#myPhoto").rotate(-15); });
サンプルを実行
[戻る]