Skip to content

Commit

Permalink
Animate
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed May 30, 2012
1 parent 0d16f78 commit 7a7c458
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dom/animate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ steal('jquery', 'jquery/dom/styles').then(function () {
transitionEnd : 'msTransitionEnd',
prefix : '-ms-'
},
*/
'MozTransition': {
transitionEnd : 'animationend',
prefix : '-moz-'
},
*/
'WebkitTransition': {
transitionEnd : 'webkitAnimationEnd',
prefix : '-webkit-'
Expand Down Expand Up @@ -183,7 +183,7 @@ steal('jquery', 'jquery/dom/styles').then(function () {

if (callback && exec) {
// Call success, pass the DOM element as the this reference
callback.apply(self[0], true)
callback.call(self[0], true)
}

jQuery.removeData(self, dataKey, true);
Expand Down
15 changes: 15 additions & 0 deletions dom/animate/animate.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ The following example creates a fade-in effect using CSS animations:
console.log('Animation done');
});

If you want to force a jQuery animation pass the `jquery` option. The animation callback gets passed `true` if
the animation has been done using CSS animations:

$('#element').css({
opacity : 0,
jquery : true
}).anifast({
opacity : 1
}, 1000, function(usedCss) {
console.log('Animation done');
if(!usedCss) {
console.log('Used jQuery animation');
}
});

## Demo

The following demo is based on the [jQuery .animate reference](http://api.jquery.com/animate/) but uses CSS animations:
Expand Down
11 changes: 5 additions & 6 deletions dom/animate/animate_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,22 +450,21 @@ steal('jquery/dom/animate',

var divs = jQuery("div"), count = 0;

console.log('Animating with no props')
divs.animate({}, function () {
count++;
});

equal(divs.length, count, "Make sure that callback is called for each element in the set.");

stop();
//stop();

var foo = jQuery("#foo");

foo.animate({});
foo.animate({top : 10}, 100, function () {
ok(true, "Animation was properly dequeued.");
start();
});
// foo.animate({top : 10}, 100, function () {
// ok(true, "Animation was properly dequeued.");
// start();
// });
});

test("animate duration 0", function () {
Expand Down

0 comments on commit 7a7c458

Please sign in to comment.