jQuery: pulsate effect

jQuery UI provides a useful effect called pulsate that makes an element pulsate by adjusting its opacity several times. This effect accepts as its options a speed parameter (expressed in milliseconds) and an integer value that specifies how many times the animation should be repeated. Its syntax is as follows:

element.effect('pulsate', options, speed);

options is an object literal and has as its parameter the times property that specifies the number of animations to run. An example:

$('#gallery img').each(function() {
  
    var $img = $(this);
    
    $img.click(function() {
    
      $img.effect('pulsate', {times: 3}, 600);
    
    
    });
  
  
});

You can see a demo below.

Demo

Live demo

References

jQuery UI documentation

This entry was posted in by Gabriele Romanato. Bookmark the permalink.

Leave a Reply

Note: Only a member of this blog may post a comment.