Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

52 righe
1.2 KiB

  1. /*
  2. * jQuery UI Effects Pulsate 1.8
  3. *
  4. * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
  5. * Dual licensed under the MIT (MIT-LICENSE.txt)
  6. * and GPL (GPL-LICENSE.txt) licenses.
  7. *
  8. * http://docs.jquery.com/UI/Effects/Pulsate
  9. *
  10. * Depends:
  11. * jquery.effects.core.js
  12. */
  13. (function($) {
  14. $.effects.pulsate = function(o) {
  15. return this.queue(function() {
  16. var elem = $(this),
  17. mode = $.effects.setMode(elem, o.options.mode || 'show');
  18. times = ((o.options.times || 5) * 2) - 1;
  19. duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,
  20. isVisible = elem.is(':visible'),
  21. animateTo = 0;
  22. if (!isVisible) {
  23. elem.css('opacity', 0).show();
  24. animateTo = 1;
  25. }
  26. if ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {
  27. times--;
  28. }
  29. for (var i = 0; i < times; i++) {
  30. elem.animate({ opacity: animateTo }, duration, o.options.easing);
  31. animateTo = (animateTo + 1) % 2;
  32. }
  33. elem.animate({ opacity: animateTo }, duration, o.options.easing, function() {
  34. if (animateTo == 0) {
  35. elem.hide();
  36. }
  37. (o.callback && o.callback.apply(this, arguments));
  38. });
  39. elem
  40. .queue('fx', function() { elem.dequeue(); })
  41. .dequeue();
  42. });
  43. };
  44. })(jQuery);