2 * jquery UI Effects Slide 1.8.4
4 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT or GPL Version 2 licenses.
6 * http://jquery.org/license
8 * http://docs.jquery.com/UI/Effects/Slide
11 * jquery.effects.core.js
13 (function( $, undefined ) {
15 $.effects.slide = function(o) {
17 return this.queue(function() {
20 var el = $(this), props = ['position','top','left'];
23 var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
24 var direction = o.options.direction || 'left'; // Default Direction
27 $.effects.save(el, props); el.show(); // Save & Show
28 $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
29 var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
30 var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
31 var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
32 if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
36 animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
39 el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
40 if(mode == 'hide') el.hide(); // Hide
41 $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
42 if(o.callback) o.callback.apply(this, arguments); // Callback