rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.3k stars 864 forks source link

Not a drop in replacement for .animate(); .stop(), among other things, doesn't work with it #232

Open sadtaco opened 8 years ago

sadtaco commented 8 years ago

The details of it make it sound like a drop in replacement for .animate() but there are a number of issues I found that make it not.

with .animate() if you call .stop(true) it will drop all current animations on the element.

scrollTop: and some other properties also aren't valid for .transition()

milosdjakonovic commented 8 years ago

"sound like" differs from "is".

You can't use $.fn.transition() as drop-in replacement for $.fn.animate(). It was not a design goal of this project, as far as I know.

True for .stop() but you can stop transition easily with saving transitioning property in at-the-moment state and, in same time setting $(element).css({ transition: 'all 0ms' }) which cuts off transition immediately.

You're absolutely right for not being able to use this lib for scrollTop - scrollTop is document property and not node style value.

br4nnigan commented 8 years ago

options handling is also different

while it is the syntax for .transition you can't .animate({ x: 0, duration: 500 }) but you have to provide a second object as an argument

not sure why this is different in the first place

baijunjie commented 7 years ago

You can try https://github.com/baijunjie/jquery.animate