effect-fade.js 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*!
  2. * jQuery UI Effects Fade 1.14.1
  3. * https://jqueryui.com
  4. *
  5. * Copyright OpenJS Foundation and other contributors
  6. * Released under the MIT license.
  7. * https://jquery.org/license
  8. */
  9. //>>label: Fade Effect
  10. //>>group: Effects
  11. //>>description: Fades the element.
  12. //>>docs: https://api.jqueryui.com/fade-effect/
  13. //>>demos: https://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. "../version",
  21. "../effect"
  22. ], factory );
  23. } else {
  24. // Browser globals
  25. factory( jQuery );
  26. }
  27. } )( function( $ ) {
  28. "use strict";
  29. return $.effects.define( "fade", "toggle", function( options, done ) {
  30. var show = options.mode === "show";
  31. $( this )
  32. .css( "opacity", show ? 0 : 1 )
  33. .animate( {
  34. opacity: show ? 1 : 0
  35. }, {
  36. queue: false,
  37. duration: options.duration,
  38. easing: options.easing,
  39. complete: done
  40. } );
  41. } );
  42. } );