You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

1 year ago
  1. /*!
  2. * jQuery UI Effects Scale 1.13.2
  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. //>>label: Scale Effect
  10. //>>group: Effects
  11. //>>description: Grows or shrinks an element and its content.
  12. //>>docs: http://api.jqueryui.com/scale-effect/
  13. //>>demos: http://jqueryui.com/effect/
  14. ( function( factory ) {
  15. "use strict";
  16. if ( typeof define === "function" && define.amd ) {
  17. // AMD. Register as an anonymous module.
  18. define( [
  19. "jquery",
  20. "./effect",
  21. "./effect-size"
  22. ], factory );
  23. } else {
  24. // Browser globals
  25. factory( jQuery );
  26. }
  27. } )( function( $ ) {
  28. "use strict";
  29. return $.effects.define( "scale", function( options, done ) {
  30. // Create element
  31. var el = $( this ),
  32. mode = options.mode,
  33. percent = parseInt( options.percent, 10 ) ||
  34. ( parseInt( options.percent, 10 ) === 0 ? 0 : ( mode !== "effect" ? 0 : 100 ) ),
  35. newOptions = $.extend( true, {
  36. from: $.effects.scaledDimensions( el ),
  37. to: $.effects.scaledDimensions( el, percent, options.direction || "both" ),
  38. origin: options.origin || [ "middle", "center" ]
  39. }, options );
  40. // Fade option to support puff
  41. if ( options.fade ) {
  42. newOptions.from.opacity = 1;
  43. newOptions.to.opacity = 0;
  44. }
  45. $.effects.effect.size.call( this, newOptions, done );
  46. } );
  47. } );