本文實例講述了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 );}// //www.49028c.com Then use the above function as:$( '#importantElement' ).flash( '255,0,0', 1000 );
希望本文所述對大家的jQuery程序設計有所幫助。
新聞熱點
疑難解答