diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-05-23 09:26:18 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-05-23 09:26:18 +0000 |
commit | ab281b36d7cc10913a77f2f8da9ff7b7c011b3ee (patch) | |
tree | e75c648d2ee6a4fb467a2f1a2d092e1544a938a5 /ui/source/effects.fold.js | |
parent | 489160abd896aac7c140775207d18a3bf489c08f (diff) | |
download | jquery-ui-ab281b36d7cc10913a77f2f8da9ff7b7c011b3ee.tar.gz jquery-ui-ab281b36d7cc10913a77f2f8da9ff7b7c011b3ee.zip |
Diffstat (limited to 'ui/source/effects.fold.js')
-rw-r--r-- | ui/source/effects.fold.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ui/source/effects.fold.js b/ui/source/effects.fold.js new file mode 100644 index 000000000..f2738c2aa --- /dev/null +++ b/ui/source/effects.fold.js @@ -0,0 +1,39 @@ +;(function($) { + + $.effects.fold = function(o) { + + return this.queue(function() { + + // Create element + var el = $(this), props = ['position','top','left']; + + // Set options + var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode + var size = o.options.size || 15; // Default fold size + + // Adjust + $.effects.save(el, props); el.show(); // Save & Show + var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper + var ref = (mode == 'show') ? ['width', 'height'] : ['height', 'width']; + var distance = (mode == 'show') ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; + if(mode == 'show') wrapper.css({height: size, width: 0}); // Shift + + // Animation + var animation1 = {}, animation2 = {}; + animation1[ref[0]] = mode == 'show' ? distance[0] : size; + animation2[ref[1]] = mode == 'show' ? distance[1] : 0; + + // Animate + wrapper.animate(animation1, o.duration / 2, o.options.easing) + .animate(animation2, o.duration / 2, o.options.easing, function() { + if(mode == 'hide') el.hide(); // Hide + $.effects.restore(el, props); $.effects.removeWrapper(el); // Restore + if(o.callback) o.callback.apply(this, arguments); // Callback + el.dequeue(); + }); + + }); + + }; + +})(jQuery);
\ No newline at end of file |