| 1 | /*!
|
|---|
| 2 | * jQuery UI Effects Slide 1.10.3
|
|---|
| 3 | * http://jqueryui.com
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 2013 jQuery Foundation and other contributors
|
|---|
| 6 | * Released under the MIT license.
|
|---|
| 7 | * http://jquery.org/license
|
|---|
| 8 | *
|
|---|
| 9 | * http://api.jqueryui.com/slide-effect/
|
|---|
| 10 | *
|
|---|
| 11 | * Depends:
|
|---|
| 12 | * jquery.ui.effect.js
|
|---|
| 13 | */
|
|---|
| 14 | (function( $, undefined ) {
|
|---|
| 15 |
|
|---|
| 16 | $.effects.effect.slide = function( o, done ) {
|
|---|
| 17 |
|
|---|
| 18 | // Create element
|
|---|
| 19 | var el = $( this ),
|
|---|
| 20 | props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
|
|---|
| 21 | mode = $.effects.setMode( el, o.mode || "show" ),
|
|---|
| 22 | show = mode === "show",
|
|---|
| 23 | direction = o.direction || "left",
|
|---|
| 24 | ref = (direction === "up" || direction === "down") ? "top" : "left",
|
|---|
| 25 | positiveMotion = (direction === "up" || direction === "left"),
|
|---|
| 26 | distance,
|
|---|
| 27 | animation = {};
|
|---|
| 28 |
|
|---|
| 29 | // Adjust
|
|---|
| 30 | $.effects.save( el, props );
|
|---|
| 31 | el.show();
|
|---|
| 32 | distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
|
|---|
| 33 |
|
|---|
| 34 | $.effects.createWrapper( el ).css({
|
|---|
| 35 | overflow: "hidden"
|
|---|
| 36 | });
|
|---|
| 37 |
|
|---|
| 38 | if ( show ) {
|
|---|
| 39 | el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | // Animation
|
|---|
| 43 | animation[ ref ] = ( show ?
|
|---|
| 44 | ( positiveMotion ? "+=" : "-=") :
|
|---|
| 45 | ( positiveMotion ? "-=" : "+=")) +
|
|---|
| 46 | distance;
|
|---|
| 47 |
|
|---|
| 48 | // Animate
|
|---|
| 49 | el.animate( animation, {
|
|---|
| 50 | queue: false,
|
|---|
| 51 | duration: o.duration,
|
|---|
| 52 | easing: o.easing,
|
|---|
| 53 | complete: function() {
|
|---|
| 54 | if ( mode === "hide" ) {
|
|---|
| 55 | el.hide();
|
|---|
| 56 | }
|
|---|
| 57 | $.effects.restore( el, props );
|
|---|
| 58 | $.effects.removeWrapper( el );
|
|---|
| 59 | done();
|
|---|
| 60 | }
|
|---|
| 61 | });
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | })(jQuery);
|
|---|