aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.effect-slide.js
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2012-07-12 23:57:55 +0200
committerFelix Nagel <info@felixnagel.com>2012-07-12 23:57:55 +0200
commit5092d0296a010280ee9d004f2fe06afbf1c45db5 (patch)
treeac6b97b4551b4aebf8d90cc35add82fc7088e0a3 /ui/jquery.ui.effect-slide.js
parent39532f0a8e70e21e33aab03f08136f662d03a4a1 (diff)
parente054e28836e616ed03561d5a8195bbea525866d1 (diff)
downloadjquery-ui-5092d0296a010280ee9d004f2fe06afbf1c45db5.tar.gz
jquery-ui-5092d0296a010280ee9d004f2fe06afbf1c45db5.zip
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.effect-slide.js')
-rw-r--r--ui/jquery.ui.effect-slide.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/ui/jquery.ui.effect-slide.js b/ui/jquery.ui.effect-slide.js
new file mode 100644
index 000000000..d61047b8b
--- /dev/null
+++ b/ui/jquery.ui.effect-slide.js
@@ -0,0 +1,66 @@
+/*!
+ * jQuery UI Effects Slide @VERSION
+ * http://jqueryui.com
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * http://docs.jquery.com/UI/Effects/Slide
+ *
+ * Depends:
+ * jquery.ui.effect.js
+ */
+(function( $, undefined ) {
+
+$.effects.effect.slide = function( o, done ) {
+
+ // Create element
+ var el = $( this ),
+ props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+ mode = $.effects.setMode( el, o.mode || "show" ),
+ show = mode === "show",
+ direction = o.direction || "left",
+ ref = (direction === "up" || direction === "down") ? "top" : "left",
+ positiveMotion = (direction === "up" || direction === "left"),
+ distance,
+ animation = {};
+
+ // Adjust
+ $.effects.save( el, props );
+ el.show();
+ distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]({
+ margin: true
+ });
+
+ $.effects.createWrapper( el ).css({
+ overflow: "hidden"
+ });
+
+ if ( show ) {
+ el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+ }
+
+ // Animation
+ animation[ ref ] = ( show ?
+ ( positiveMotion ? "+=" : "-=") :
+ ( positiveMotion ? "-=" : "+=")) +
+ distance;
+
+ // Animate
+ el.animate( animation, {
+ queue: false,
+ duration: o.duration,
+ easing: o.easing,
+ complete: function() {
+ if ( mode === "hide" ) {
+ el.hide();
+ }
+ $.effects.restore( el, props );
+ $.effects.removeWrapper( el );
+ done();
+ }
+ });
+};
+
+})(jQuery);