mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Allow folding to occur horizontally first
This commit is contained in:
parent
3f38ebc88d
commit
9c1a055880
@ -22,13 +22,17 @@ $.effects.fold = function(o) {
|
|||||||
// Set options
|
// Set options
|
||||||
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
var mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode
|
||||||
var size = o.options.size || 15; // Default fold size
|
var size = o.options.size || 15; // Default fold size
|
||||||
|
var horizFirst = !(!o.options.horizFirst); // Ensure a boolean value
|
||||||
|
|
||||||
// Adjust
|
// Adjust
|
||||||
$.effects.save(el, props); el.show(); // Save & Show
|
$.effects.save(el, props); el.show(); // Save & Show
|
||||||
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
var wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper
|
||||||
var ref = (mode == 'show') ? ['width', 'height'] : ['height', 'width'];
|
var widthFirst = ((mode == 'show') != horizFirst);
|
||||||
var distance = (mode == 'show') ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];
|
var ref = widthFirst ? ['width', 'height'] : ['height', 'width'];
|
||||||
if(mode == 'show') wrapper.css({height: size, width: 0}); // Shift
|
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
|
// Animation
|
||||||
var animation1 = {}, animation2 = {};
|
var animation1 = {}, animation2 = {};
|
||||||
|
Loading…
Reference in New Issue
Block a user