[置頂]   jQuery旋轉(zhuǎn)插件—rotate

網(wǎng)上發(fā)現(xiàn)一個(gè)很有意思的jQuery旋轉(zhuǎn)插件,支持Internet Explorer 6.0+ 、Firefox 2.0 、Safari 3 、Opera 9 、Google Chrome,高級(jí)瀏覽器下使用Transform,低版本ie使用VML實(shí)現(xiàn)。

網(wǎng)站建設(shè)哪家好,找創(chuàng)新互聯(lián)!專(zhuān)注于網(wǎng)頁(yè)設(shè)計(jì)、網(wǎng)站建設(shè)、微信開(kāi)發(fā)、小程序定制開(kāi)發(fā)、集團(tuán)企業(yè)網(wǎng)站建設(shè)等服務(wù)項(xiàng)目。為回饋新老客戶(hù)創(chuàng)新互聯(lián)還提供了高坪免費(fèi)建站歡迎大家使用!

調(diào)用和方法:
rotate(angle)

angle參數(shù):[Number] – 默認(rèn)為 0 – 根據(jù)給定的角度旋轉(zhuǎn)圖片

例如:

1 $("#img").rotate(45);

rotate(parameters)

parameters參數(shù):[Object] 包含旋轉(zhuǎn)參數(shù)的對(duì)象。支持的屬性:

  1. angle屬性:[Number] – default 0 – 旋轉(zhuǎn)的角度數(shù),并且立即執(zhí)行
    例如:

     

    1 $("#img").rotate({angle:45});
  2. bind屬性:[Object] 對(duì)象,包含綁定到一個(gè)旋轉(zhuǎn)對(duì)象的事件。事件內(nèi)部的$(this)指向旋轉(zhuǎn)對(duì)象-這樣你可以在內(nèi)部鏈?zhǔn)秸{(diào)用- $(this).rotate(…)。例如 (click on arrow):
    $("#img").rotate({bind:{  click: function(){  $(this).rotate({  angle: 0,  animateTo:180 }) } } });
  3. animateTo屬性:[Number] – default 0 – 從當(dāng)前角度值動(dòng)畫(huà)旋轉(zhuǎn)到給定的角度值 (或給定的角度參數(shù))例如: 結(jié)合上面的例子,請(qǐng)參閱使用。
  4. duration屬性:[Number] – 指定使用animateTo的動(dòng)畫(huà)執(zhí)行持續(xù)時(shí)間例如 (click on arrow):
      

    $("#img").rotate({bind:{ click: function(){ $(this).rotate({ duration:6000, angle: 0, animateTo:100 }) } } });

  5. step屬性:[Function] – 每個(gè)動(dòng)畫(huà)步驟中執(zhí)行的回調(diào)函數(shù),當(dāng)前角度值作為該函數(shù)的第一個(gè)參數(shù)
  6. easing屬性:[Function] – 默認(rèn) (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({ angle: 0, animateTo:180, easing: $.easing.easeInOutElastic }) } } });
  7. callback屬性:[Function] 動(dòng)畫(huà)完成時(shí)執(zhí)行的回調(diào)函數(shù)例如 (click on arrow):
    $("#img").rotate({bind:{  click: function(){ $(this).rotate({ angle: 0, animateTo:180, callback: function(){ alert(1) } }) } } });

getRotateAngle

這個(gè)函數(shù)只是簡(jiǎn)單地返回旋轉(zhuǎn)對(duì)象當(dāng)前的角度。

例如:

1 $("#img").rotate({ 2 angle: 45, 3 bind: { 4 click : function(){ 5 alert($(this).getRotateAngle()); 6 } 7 } 8 });

stopRotate

這個(gè)函數(shù)只是簡(jiǎn)單地停止正在進(jìn)行的旋轉(zhuǎn)動(dòng)畫(huà)。

例如:

1 $("#img").rotate({  2 bind: {  3 click: function(){  4 $("#img").rotate({  5 angle: 0,  6 animateTo: 180,  7 duration: 6000  8 });  9 setTimeout(function(){ 10 $("#img").stopRotate(); 11 }, 1000); 12 } 13 } 14 });

當(dāng)前名稱(chēng):[置頂]   jQuery旋轉(zhuǎn)插件—rotate
標(biāo)題鏈接:http://muchs.cn/article48/jogiep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT服務(wù)器托管、動(dòng)態(tài)網(wǎng)站、微信公眾號(hào)、App設(shè)計(jì)、靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司