Skip to content

Commit

Permalink
Fixed IE NaN issue. Fixed blinking caused by callback race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
razorjack committed Jan 8, 2011
1 parent 5374b63 commit 04c63d7
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions jquery.quicksand.js
Expand Up @@ -68,16 +68,24 @@ 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 () {

if (!postCallbackPerformed) {
$sourceParent.html($dest.html()); // put target HTML into visible source container
if (typeof callbackFunction == 'function') {
callbackFunction.call(this);
}
postCallbackPerformed = 1;

// hack:
// used to be: $sourceParent.html($dest.html()); // put target HTML into visible source container
// but new webkit builds cause flickering when replacing the collections
$toDelete = $sourceParent.find('> *');
$sourceParent.prepend($dest.find('> *'));
$toDelete.remove();

if (adjustHeightOnCallback) {
$sourceParent.css('height', destHeight);
}
options.enhancement($sourceParent); // Perform custom visual enhancements on a newly replaced collection
postCallbackPerformed = 1;
if (typeof callbackFunction == 'function') {
callbackFunction.call(this);
}
}
};

Expand All @@ -88,14 +96,14 @@ Github site: http://github.com/razorjack/quicksand
if ($correctionParent.get(0).nodeName.toLowerCase() == 'body') {

} else {
correctionOffset.top += parseFloat($correctionParent.css('border-top-width'));
correctionOffset.left += parseFloat($correctionParent.css('border-left-width'));
correctionOffset.top += (parseFloat($correctionParent.css('border-top-width')) || 0);
correctionOffset.left +=( parseFloat($correctionParent.css('border-left-width')) || 0);
}
} else {
correctionOffset.top -= parseFloat($correctionParent.css('border-top-width'));
correctionOffset.left -= parseFloat($correctionParent.css('border-left-width'));
correctionOffset.top -= parseFloat($correctionParent.css('margin-top'));
correctionOffset.left -= parseFloat($correctionParent.css('margin-left'));
correctionOffset.top -= (parseFloat($correctionParent.css('border-top-width')) || 0);
correctionOffset.left -= (parseFloat($correctionParent.css('border-left-width')) || 0);
correctionOffset.top -= (parseFloat($correctionParent.css('margin-top')) || 0);
correctionOffset.left -= (parseFloat($correctionParent.css('margin-left')) || 0);
}

// perform custom corrections from options (use when Quicksand fails to detect proper correction)
Expand Down

0 comments on commit 04c63d7

Please sign in to comment.