此 jQuery 旋轉插件可讓元素依指定角度旋轉,並支援動畫、回調與步驟函數。高階瀏覽器使用 CSS Transform,舊版 IE 則以 VML 模擬。
$("#img").rotate(45);
$("#img").rotate({ angle: 45 });
$("#img").rotate({
bind: {
click: function () {
$(this).rotate({ angle: 0, animateTo: 180, duration: 6000 });
}
}
});
另有 getRotateAngle() 可取得目前角度,stopRotate() 可停止進行中的動畫,適合製作轉盤、旋轉提示與互動視覺。