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.

72 lines
1.6 KiB

1 year ago
  1. /*!
  2. * jQuery UI Effects Blind 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: Blind Effect
  10. //>>group: Effects
  11. //>>description: Blinds the element.
  12. //>>docs: http://api.jqueryui.com/blind-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. ], factory );
  22. } else {
  23. // Browser globals
  24. factory( jQuery );
  25. }
  26. } )( function( $ ) {
  27. "use strict";
  28. return $.effects.define( "blind", "hide", function( options, done ) {
  29. var map = {
  30. up: [ "bottom", "top" ],
  31. vertical: [ "bottom", "top" ],
  32. down: [ "top", "bottom" ],
  33. left: [ "right", "left" ],
  34. horizontal: [ "right", "left" ],
  35. right: [ "left", "right" ]
  36. },
  37. element = $( this ),
  38. direction = options.direction || "up",
  39. start = element.cssClip(),
  40. animate = { clip: $.extend( {}, start ) },
  41. placeholder = $.effects.createPlaceholder( element );
  42. animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];
  43. if ( options.mode === "show" ) {
  44. element.cssClip( animate.clip );
  45. if ( placeholder ) {
  46. placeholder.css( $.effects.clipToBox( animate ) );
  47. }
  48. animate.clip = start;
  49. }
  50. if ( placeholder ) {
  51. placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
  52. }
  53. element.animate( animate, {
  54. queue: false,
  55. duration: options.duration,
  56. easing: options.easing,
  57. complete: done
  58. } );
  59. } );
  60. } );