Skip to content

Commit

Permalink
Updated 0.10.3 beta
Browse files Browse the repository at this point in the history
Fixes an issue with jQuery .animate animation method
  • Loading branch information
adchsm committed Apr 1, 2015
1 parent ed7f7c0 commit 9a20999
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions development/slidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,31 +165,35 @@
// Apply animation
if ( animation === 'translate' ) {
if ( amount === '0px' ) {
removeAnimation();
removeStyleAttributes();
} else {
selector.css( 'transform', 'translate( ' + amount + ' )' ); // Apply the animation.
}

} else if ( animation === 'side' ) {
if ( amount === '0px' ) {
removeAnimation();
removeStyleAttributes();
} else {
if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for side animations.
selector.css( side, '0px' ); // Add a 0 value so css transition works.
setTimeout( function () { // Set a timeout to allow the 0 value to be applied above.
selector.css( side, amount ); // Apply the animation.
}, 1 );
}

} else if ( animation === 'jQuery' ) {
if ( amount[0] === '-' ) amount = amount.substr( 1 ); // Remove the '-' from the passed amount for jQuery animations.
var properties = {};
properties[side] = amount;
selector.stop().animate( properties, 400 ); // Stop any current jQuery animation before starting another.

if ( amount === '0px' ) {
setTimeout( removeStyleAttributes, 400 );
}
}

// Remove animation
function removeAnimation () {
function removeStyleAttributes() {
// Remove animation
selector.removeAttr( 'style' );
css();
}
Expand Down

0 comments on commit 9a20999

Please sign in to comment.