Posted By

bananaskin198 on 08/01/13


Tagged


Versions (?)

jQuery Pulse / infinite background color fade in fade out


 / Published in: jQuery
 

Requires jQuery Color plugin

  1. (function($) {
  2. $.fn.pulse = function(options) {
  3.  
  4. options = $.extend({
  5. fadeFrom: "#87ff9b",
  6. fadeTo: "#FFFFFF"
  7. }, options);
  8.  
  9.  
  10. return this.each(function() {
  11.  
  12. var current = $(this);
  13. setInterval(function () {
  14. $(current).animate({'backgroundColor' : options.fadeFrom},1000)
  15. .animate({'backgroundColor' : options.fadeTo},1000)
  16. }, 1);
  17.  
  18. });
  19.  
  20. }
  21.  
  22. })(jQuery);
  23.  
  24. $(document).ready(function(){
  25.  
  26. $(this).pulse({"fadeFrom":"#87ff9b"});
  27.  
  28. });

Report this snippet  

You need to login to post a comment.