Skip to content
Permalink
Browse files

Allow folding to occur horizontally first

  • Loading branch information
Keith Wood
Keith Wood committed Jun 16, 2008
1 parent 3f38ebc commit 9c1a05588005e8d8544437e426e554c254eac95e
Showing with 7 additions and 3 deletions.
  1. +7 −3 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 = {};

0 comments on commit 9c1a055

Please sign in to comment.
You can’t perform that action at this time.