question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Info: Can I globally swap out $.animate() with $.velocity()?

See original GitHub issue

I was messing around with swapping out the animate function entirely to see if I could utilize velocity without having to alter third-party scripts (in this case a Wordpress theme). Is this something that is supported and/or recommended?

I put the following after both jQuery and velocity are included:

jQuery.fn.animate = jQuery.velocity.animate;

Any tips or ideas appreciated. Thanks for the work on this great plugin!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
julianshapirocommented, Apr 30, 2014

Once Velocity has loaded, you would include this:

jQuery.fn.animate = jQuery.fn.velocity;

The reason Velocity doesn’t overwrite $.animate() automatically is because it’s considered bad practice to overwrite third-party API’s since you can never guarantee 100% API compatibility, and I do not claim to do so with Velocity.

I wouldn’t want to go on record as recommending you do it, but by all means you can try it 😃

0reactions
julianshapirocommented, May 1, 2014

Thanks a bunch for reporting back, Jason. This is really helpful for others.

The implementations of “stop” are also different in jQuery and Velocity: http://julian.com/research/velocity/#stop

Indeed, there’s a reason Velocity compresses to 7kb and jQuery compresses to 33kb. jQuery is a swiss-army knife, and that’s its power.

Stay tuned for the removal of the jQuery dependency thanks to @nmussy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

.animate() | jQuery API Documentation
animate() , can be turned off globally by setting jQuery.fx.off = true , which effectively sets the duration to 0. For more information,...
Read more >
animate.css animation speed control - Stack Overflow
You can change animation duration globally for everything with .animated class. For example, here I changed it to 0.6s and worked well for...
Read more >
animation-timing-function - CSS: Cascading Style Sheets | MDN
The animation-timing-function CSS property sets how an animation progresses through the duration of each cycle.
Read more >
Set the start time and speed of an animation effect
On the Animations tab, in the Duration box, enter the number of seconds that you want the effect to run.
Read more >
The ultimate guide to proper use of animation in UX
Generally speaking, we can use it for the states when an object does not change its position. Ease-in or acceleration curve. We can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found