diff options
author | Keith Wood <kbwood.au@gmail.com> | 2008-06-16 10:20:41 +0000 |
---|---|---|
committer | Keith Wood <kbwood.au@gmail.com> | 2008-06-16 10:20:41 +0000 |
commit | 9c1a05588005e8d8544437e426e554c254eac95e (patch) | |
tree | fccc08857658a66b84cdbf78f910b51182a3110b | |
parent | 3f38ebc88dddac4aa6c5d7acf91891945bb2fc82 (diff) | |
download | jquery-ui-9c1a05588005e8d8544437e426e554c254eac95e.tar.gz jquery-ui-9c1a05588005e8d8544437e426e554c254eac95e.zip |
Allow folding to occur horizontally first
-rw-r--r-- | ui/effects.fold.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/effects.fold.js b/ui/effects.fold.js index f67b7da61..9fa1e661e 100644 --- a/ui/effects.fold.js +++ b/ui/effects.fold.js @@ -22,13 +22,17 @@ $.effects.fold = function(o) { // Set options var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode var size = o.options.size || 15; // Default fold size + var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value // 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 + var widthFirst = ((mode == 'show') != horizFirst); + var ref = widthFirst ? ['width', 'height'] : ['height', 'width']; + var distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()]; + var percent = /([0-9]+)%/.exec(size); + if(percent) size = parseInt(percent[1]) / 100 * distance[mode == 'hide' ? 0 : 1]; + if(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift // Animation var animation1 = {}, animation2 = {}; |