effect-puff.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*!
  2. * jQuery UI Effects Puff 1.11.4
  3. * http://jqueryui.com
  4. *
  5. * Copyright jQuery Foundation and other contributors
  6. * Released under the MIT license.
  7. * http://jquery.org/license
  8. *
  9. * http://api.jqueryui.com/puff-effect/
  10. */
  11. (function( factory ) {
  12. if ( typeof define === "function" && define.amd ) {
  13. // AMD. Register as an anonymous module.
  14. define([
  15. "jquery",
  16. "./effect",
  17. "./effect-scale"
  18. ], factory );
  19. } else {
  20. // Browser globals
  21. factory( jQuery );
  22. }
  23. }(function( $ ) {
  24. return $.effects.effect.puff = function( o, done ) {
  25. var elem = $( this ),
  26. mode = $.effects.setMode( elem, o.mode || "hide" ),
  27. hide = mode === "hide",
  28. percent = parseInt( o.percent, 10 ) || 150,
  29. factor = percent / 100,
  30. original = {
  31. height: elem.height(),
  32. width: elem.width(),
  33. outerHeight: elem.outerHeight(),
  34. outerWidth: elem.outerWidth()
  35. };
  36. $.extend( o, {
  37. effect: "scale",
  38. queue: false,
  39. fade: true,
  40. mode: mode,
  41. complete: done,
  42. percent: hide ? percent : 100,
  43. from: hide ?
  44. original :
  45. {
  46. height: original.height * factor,
  47. width: original.width * factor,
  48. outerHeight: original.outerHeight * factor,
  49. outerWidth: original.outerWidth * factor
  50. }
  51. });
  52. elem.effect( o );
  53. };
  54. }));