client/player/res/js/ui/jquery.effects.slide.js
author ymh <ymh.work@gmail.com>
Fri, 06 Aug 2010 16:29:21 +0200
changeset 30 2f27e07f9974
parent 29 client/player/res.new/js/ui/jquery.effects.slide.js@d969ba10156c
permissions -rw-r--r--
lowercase folder names
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     1
/*
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     2
 * jQuery UI Effects Slide 1.8.1
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     3
 *
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     4
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     5
 * Dual licensed under the MIT (MIT-LICENSE.txt)
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     6
 * and GPL (GPL-LICENSE.txt) licenses.
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     7
 *
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     8
 * http://docs.jquery.com/UI/Effects/Slide
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
     9
 *
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    10
 * Depends:
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    11
 *	jquery.effects.core.js
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    12
 */
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    13
(function($) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    14
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    15
$.effects.slide = function(o) {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    16
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    17
	return this.queue(function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    18
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    19
		// Create element
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    20
		var el = $(this), props = ['position','top','left'];
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    21
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    22
		// Set options
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    23
		var mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    24
		var direction = o.options.direction || 'left'; // Default Direction
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    25
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    26
		// Adjust
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    27
		$.effects.save(el, props); el.show(); // Save & Show
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    28
		$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    29
		var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    30
		var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    31
		var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true}));
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    32
		if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance); // Shift
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    33
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    34
		// Animation
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    35
		var animation = {};
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    36
		animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    37
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    38
		// Animate
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    39
		el.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    40
			if(mode == 'hide') el.hide(); // Hide
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    41
			$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    42
			if(o.callback) o.callback.apply(this, arguments); // Callback
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    43
			el.dequeue();
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    44
		}});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    45
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    46
	});
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    47
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    48
};
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    49
44c6b827825d Commit new player (version radio) with new path organisation
hurons
parents:
diff changeset
    50
})(jQuery);