萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> jquery讓指定的元素閃爍顯示的方法

jquery讓指定的元素閃爍顯示的方法

 這篇文章主要介紹了jquery讓指定的元素閃爍顯示的方法,涉及jQuery操作css樣式的技巧,非常具有實用價值,需要的朋友可以參考下

   

本文實例講述了jquery讓指定的元素閃爍顯示的方法。分享給大家供大家參考。具體如下:

這段jQuery代碼非常簡單,功能就是讓指定的元素不斷的變換顏色,閃爍顯示,調用也非常簡單。

? 1 2 3 4 5 6 7 8 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.jb51.net Then use the above function as: $( '#importantElement' ).flash( '255,0,0', 1000 );

希望本文所述對大家的jQuery程序設計有所幫助。

copyright © 萬盛學電腦網 all rights reserved