css3元素簡單的閃爍效果 (html5 jquery)

來源:互聯網
上載者:User
css3 Animation:

@-webkit-keyframes twinkling{    /*透明度由0到1*/    0%{       opacity:0; /*透明度為0*/     }    100%{       opacity:1; /*透明度為1*/     }  }

Jquery :

   $(element).css({"-webkit-animation":"twinkling 1s infinite ease-in-out"}); //在對象element中添加閃爍動畫

也可以在css樣式裡添加如下:

    #element{           -webkit-animation: twinkling 1s infinite ease-in-out;       }

註:動畫名稱為twinkling 時間為1s 動畫次數為無限次 動畫效果ease-in-out

簡單吧!其實用css3做動畫效果,比用flash,javascript要方便簡單多了!希望瀏覽器趕快都支援css3 Animation .目前webkit核心的瀏覽器都支援(safrai,chrome)

  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.