Permalink
Browse files

Reset only modified CSS properties

Quicksand uses top, left, opacity, position and margin properties for the animation. It would be nice to reset those properties to their original values.

Removing 'style' attribute has undesirable effect when the tag had an initial inline style. That's why we're resetting only properties we modified.
  • Loading branch information...
razorjack committed Dec 8, 2012
1 parent ef7db66 commit 484b0985019f73ad46384e27a41c70dfb6c34d5b
Showing with 1 addition and 4 deletions.
  1. +1 −4 jquery.quicksand.js
View
@@ -78,7 +78,7 @@ Github site: http://github.com/razorjack/quicksand
// Gets called when any animation is finished
var postCallbackPerformed = 0; // prevents the function from being called more than one time
var postCallback = function() {
-
+ $(this).css('margin', '').css('position', '').css('top', '').css('left', '').css('opacity', '');
if (!postCallbackPerformed) {
postCallbackPerformed = 1;
@@ -124,9 +124,6 @@ Github site: http://github.com/razorjack/quicksand
});
// Remove whatever is remaining from the DOM
$toDelete.not($keepElements).remove();
- // Remove all element styles added for the animation.
- // @todo restore original values?
- $sourceParent.find(options.selector).removeAttr('style').addClass('testing');
}
if (adjustHeightOnCallback) {

0 comments on commit 484b098

Please sign in to comment.