jQuery旋轉插件—rotate支援(ie/Firefox/SafariOpera/Chrome)_jquery
rotate
網路上發現一個很有趣的jQuery旋轉插件,支援Internet Explorer 6.0 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,進階瀏覽器下使用Transform,低版本ie使用VML實作。
呼叫與方法:
rotate(angle)
angle參數:[Number] – 預設為0 – 根據給定的角度旋轉圖片
例如:
複製程式碼 程式碼如下:
程式碼如下:
$
$ img").rotate(45);
rotate(parameters)
parameters參數:[Object] 包含旋轉參數的物件。支援的屬性:
複製程式碼
程式碼如下:$("#img").rotate({angle:45});
複製程式碼
程式碼如下:
$("#img ").rotate({bind:{
click: function(){
$(this).rotate({
angle: 0,
animateTo:180
}) 程式碼如下:
$("#img ").rotate({bind:{
click: function(){
$(this).rotate({
angle: 0,
animateTo:180
} } });
3.animateTo屬性
:[Number] – default 0 –從當前角度值動畫旋轉到給定的角度值(或給定的角度參數)例如: 結合上面的例子,請參閱使用。 4.duration屬性:[Number] – 指定使用animateTo的動畫執行持續時間例如(click on arrow):
複製程式碼
程式碼如下:
$("#img").rotate({bind:{
click: function(){
$(this(this ).rotate({
duration:6000,
angle: 0,
animateTo:100
}) 程式碼如下:
$("#img").rotate({bind:{
click: function(){
$(this(this ).rotate({
duration:6000,
angle: 0,
animateTo:100
} } });
5.step屬性:[Function] – 每個動畫步驟中執行的回呼函數,當前角度值作為該函數的第一個參數6.easing屬性:[Function] – 預設(see below) – Easing function used to make animation look more natural. It takes five parameters (x,t,b,c,d) to support easing from http://gsgd.co. uk/sandbox/jquery/easing/ (for more details please see documentation at their website). Remember to include easing plugin before using it in jQueryRotate!Default function:
程式碼如下:function (x, t, b, c, d) { return -c * ((t=t/d-1)* t*t*t - 1) b; }
Where:t: current time,
b: begInnIng value,
c: change In value,
d: duration ,
x: unused
No easing (linear easing):
複製程式碼
複製程式碼
程式碼如下:function(x, t, b, c, d) { return (t/d)*c ; }Example (click on arrow):
複製程式碼
程式碼如下:
$("#img").rotate({bind:{
click : function(){
$(this).rotate({
animateTo:180, easing: $.easing.easeInOutElastic })
}
複製程式碼
程式碼如下:
$("#img").rotate({bind:{ click: function(){
$(this).rotate({
angle: 0,
callback: function(){ alert(1) } } ) }
}
});
getRotateAngle 這個函數只是簡單地傳迴旋轉物件當前的角度。 例如:
複製程式碼 程式碼如下:$("#img").rotate({
angle: 45,
bind: {
click : function(){
alert($(this).getRotateAngle ());
}
}
});
stopRotate
這個函數只是簡單地停止正在進行的旋轉動畫。
例如:
複製程式碼 程式碼如下:
程式碼如下:
$
$ img").rotate({
bind: {
click: function(){
$("#img").rotate({
angle: 0,
animateTo: 180,
duration: 6000
});
setTimeout(function(){
$("#img").stopRotate();
}
}
}
}
}
}
} } } } } } } } } } } } ) >} });用這個可以實現很多關於旋轉的網頁特效,我用這個做了個抽獎大轉盤,效果不錯,就是沒flash順暢,基本能跑哈哈。 jqueryrotate專案位址:http://code.google.com/p/jqueryrotate/ 程式碼範例:http://code.google.com/p/jqueryrotate/wiki/Examples 一步一步往上爬
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章
R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前
By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前
By 尊渡假赌尊渡假赌尊渡假赌
擊敗分裂小說需要多長時間?
3 週前
By DDD
R.E.P.O.保存文件位置:在哪里以及如何保護它?
3 週前
By DDD

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)