Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added two new pararameters, to add functionality, #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion CHANGELOG.textile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
h1. jQuery Quicksand plugin release notes

h2. v1.2.3b
- queue: to manager if user want to run the animations in parallel(false) or not (true).
- durationFilter: Function to call for getting the timer. User when user want to use differents timers for every object.


h2. v1.2.2

- fixed Internet Explorer NaN issue
Expand Down Expand Up @@ -29,4 +34,4 @@ h2. v1.1

h2. v1.0

First, feature-complete release of jQuery Quicksand plugin.
First, feature-complete release of jQuery Quicksand plugin.
2 changes: 2 additions & 0 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ No additional CSS is required for the plugin to work. However, you should avoid
* @adjustHeight@ - @'dynamic'@ to animate height of the container (when the target collection is larger or smaller than source collection), @'auto'@ to automatically set height before or after the animation, @false@ to keep container height constant; default: @'auto'@
* @useScaling@ - use CSS3 scaling effect, default: true
* @enhancement@ - function that performs custom visual enhancements (eg. font replacements) on newly created items, default: @function() {}@
* @queue@ - manager if user want to run the animations in parallel(set it to false) or not (set it to true).
* @function@ - Function that must be to return the duration time. This function receive the @duration@ as unique parameter. (Example: you can use it with Gauss function in http://vorlon.case.edu/~vxl11/software/gauss.html)

You can specify a callback function as an optional last argument.

Expand Down
37 changes: 24 additions & 13 deletions jquery.quicksand.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*

Quicksand 1.2.2
Quicksand 1.2.3b

Reorder and filter items with a nice shuffling animation.

Expand All @@ -19,15 +19,17 @@ Github site: http://github.com/razorjack/quicksand
(function ($) {
$.fn.quicksand = function (collection, customOptions) {
var options = {
duration: 750,
easing: 'swing',
attribute: 'data-id', // attribute to recognize same items within source and dest
adjustHeight: 'auto', // 'dynamic' animates height during shuffling (slow), 'auto' adjusts it before or after the animation, false leaves height constant
useScaling: true, // disable it if you're not using scaling effect or want to improve performance
enhancement: function(c) {}, // Visual enhacement (eg. font replacement) function for cloned elements
selector: '> *',
dx: 0,
dy: 0
'duration': 750,
'easing': 'swing',
'attribute': 'data-id', // attribute to recognize same items within source and dest
'adjustHeight': 'auto', // 'dynamic' animates height during shuffling (slow), 'auto' adjusts it before or after the animation, false leaves height constant
'useScaling': true, // disable it if you're not using scaling effect or want to improve performance
'enhancement': function(c) {}, // Visual enhacement (eg. font replacement) function for cloned elements
'selector': '> *',
'dx': 0,
'dy': 0,
'queue': true, // If you need that Quicksand run in parallel with other animation, then set it in false.
'durationFilter': null // Function that must be to return the duration time. (Example: you can use it with Gauss function in http://vorlon.case.edu/~vxl11/software/gauss.html)
};
$.extend(options, customOptions);

Expand Down Expand Up @@ -175,7 +177,9 @@ Github site: http://github.com/razorjack/quicksand
if (options.adjustHeight === 'dynamic') {
// If destination container has different height than source container
// the height can be animated, adjusting it to destination height
$sourceParent.animate({height: $dest.height()}, options.duration, options.easing);
$sourceParent.animate(
{height: $dest.height()},
{'duration': options.duration, 'easing': options.easing, 'queue': options.queue});
} else if (options.adjustHeight === 'auto') {
destHeight = $dest.height();
if (parseFloat(sourceHeight) < parseFloat(destHeight)) {
Expand Down Expand Up @@ -299,9 +303,16 @@ Github site: http://github.com/razorjack/quicksand

$dest.remove();
options.enhancement($sourceParent); // Perform custom visual enhancements during the animation
var duration = options.duration;
for (i = 0; i < animationQueue.length; i++) {
animationQueue[i].element.animate(animationQueue[i].animation, options.duration, options.easing, postCallback);
// If was defined, call to durationFilter function to get the animation timer.
if ('function' == typeof(options.durationFilter)) {
duration = options.durationFilter(options.duration);
}
animationQueue[i].element.animate(
animationQueue[i].animation,
{'duration': duration, 'easing': options.easing, 'complete': postCallback, 'queue': options.queue});
}
});
};
})(jQuery);
})(jQuery);