Home  >  Article  >  Web Front-end  >  jquery method to make specified elements flash and display_jquery

jquery method to make specified elements flash and display_jquery

WBOY
WBOYOriginal
2016-05-16 16:09:061285browse

The example in this article describes how jquery makes the specified element flash. Share it with everyone for your reference. The details are as follows:

This jQuery code is very simple. Its function is to make the specified element continuously change color and flash. The call is also very simple.

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 );

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn