|
1 /*! |
|
2 * jQuery UI Effects Blind 1.12.1 |
|
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 |
|
10 //>>label: Blind Effect |
|
11 //>>group: Effects |
|
12 //>>description: Blinds the element. |
|
13 //>>docs: http://api.jqueryui.com/blind-effect/ |
|
14 //>>demos: http://jqueryui.com/effect/ |
|
15 |
|
16 ( function( factory ) { |
|
17 if ( typeof define === "function" && define.amd ) { |
|
18 |
|
19 // AMD. Register as an anonymous module. |
|
20 define( [ |
|
21 "jquery", |
|
22 "./effect" |
|
23 ], factory ); |
|
24 } else { |
|
25 |
|
26 // Browser globals |
|
27 factory( jQuery ); |
|
28 } |
|
29 }( function( $ ) { |
|
30 |
|
31 return $.effects.define( "blind", "hide", function( options, done ) { |
|
32 var map = { |
|
33 up: [ "bottom", "top" ], |
|
34 vertical: [ "bottom", "top" ], |
|
35 down: [ "top", "bottom" ], |
|
36 left: [ "right", "left" ], |
|
37 horizontal: [ "right", "left" ], |
|
38 right: [ "left", "right" ] |
|
39 }, |
|
40 element = $( this ), |
|
41 direction = options.direction || "up", |
|
42 start = element.cssClip(), |
|
43 animate = { clip: $.extend( {}, start ) }, |
|
44 placeholder = $.effects.createPlaceholder( element ); |
|
45 |
|
46 animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ]; |
|
47 |
|
48 if ( options.mode === "show" ) { |
|
49 element.cssClip( animate.clip ); |
|
50 if ( placeholder ) { |
|
51 placeholder.css( $.effects.clipToBox( animate ) ); |
|
52 } |
|
53 |
|
54 animate.clip = start; |
|
55 } |
|
56 |
|
57 if ( placeholder ) { |
|
58 placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing ); |
|
59 } |
|
60 |
|
61 element.animate( animate, { |
|
62 queue: false, |
|
63 duration: options.duration, |
|
64 easing: options.easing, |
|
65 complete: done |
|
66 } ); |
|
67 } ); |
|
68 |
|
69 } ) ); |