Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions ui/jquery.effects.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ $.effects.effect.size = function( o ) {
return this.queue( function() {
// Create element
var el = $( this ),
props = [ 'position', 'top', 'bottom', 'left', 'right', 'width', 'height', 'overflow', 'opacity' ],
props0 = [ 'position', 'top', 'bottom', 'left', 'right', 'width', 'height', 'overflow', 'opacity' ],

// Always restore
props1 = [ 'position', 'top', 'bottom', 'left', 'right', 'overflow', 'opacity' ],
Expand All @@ -117,10 +117,17 @@ $.effects.effect.size = function( o ) {
height: el.height(),
width: el.width()
},
baseline, factor;

el.from = o.from || original;
el.to = o.to || original;
baseline, factor,
props = restore ? props0 : props1,
zero = { height: 0, width: 0 };

if ( o.mode === "toggle" && mode === "show" ) {
el.from = o.to || zero;
el.to = o.from || original;
} else {
el.from = o.from || ( mode === "show" ? zero : original );
el.to = o.to || ( mode === "hide" ? zero : original );
}

// Adjust
if (origin) { // Calculate baseline shifts
Expand Down Expand Up @@ -166,13 +173,13 @@ $.effects.effect.size = function( o ) {

// Vertical props scaling
if ( factor.from.y != factor.to.y ) {
props = props.concat( cProps );
props = props.concat(cProps).concat(props2);
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
};
};

$.effects.save( el, restore ? props : props1 );
$.effects.save( el, props );
el.show();
$.effects.createWrapper( el );
el.css( 'overflow', 'hidden' ).css( el.from );
Expand All @@ -183,7 +190,7 @@ $.effects.effect.size = function( o ) {
// Add margins/font-size
vProps = vProps.concat([ 'marginTop', 'marginBottom' ]).concat(cProps);
hProps = hProps.concat([ 'marginLeft', 'marginRight' ]);
props2 = props.concat(vProps).concat(hProps);
props2 = props0.concat(vProps).concat(hProps);

el.find( "*[width]" ).each( function(){
var child = $( this ),
Expand Down Expand Up @@ -236,7 +243,7 @@ $.effects.effect.size = function( o ) {
if( mode == 'hide' ) {
el.hide();
}
$.effects.restore( el, restore ? props : props1 );
$.effects.restore( el, props );
$.effects.removeWrapper( el );
$.isFunction( o.complete ) && o.complete.apply( this, arguments ); // Callback
el.dequeue();
Expand Down