這篇文章主要介紹了jquery讓指定的元素閃爍顯示的方法,涉及jQuery操作css樣式的技巧,非常具有實用價值,需要的朋友可以參考下
本文實例講述了jquery讓指定的元素閃爍顯示的方法。分享給大家供大家參考。具體如下:
這段jQuery代碼非常簡單,功能就是讓指定的元素不斷的變換顏色,閃爍顯示,調用也非常簡單。
- jQuery.fn.flash = function( color, duration )
- {
- var current = this.css( 'color' );
- this.animate( { color: 'rgb(' + color + ')' }, duration / 2 );
- this.animate( { color: current }, duration / 2 );
- }
- // http://www.49028c.com Then use the above function as:
- $( '#importantElement' ).flash( '255,0,0', 1000 );
希望本文所述對大家的jQuery程序設計有所幫助。
新聞熱點
疑難解答
圖片精選