Replace jquery $ .animate with $ .velocity not working

I have this animation that works fine in jquery, except that it is pretty laggy. onclick, it scrolls smoothly to the desired item.

$('#aboutMenu').click(function(){
$('html, body').animate({
    scrollTop: $( $(this).attr('href') ).offset().top -200
}, 900);
return false;

According to this web page: http://julian.com/research/velocity/

I can just “download Velocity, include it on my page and replace all instances of jQuery $ .animate () with $ .velocity (). You will immediately see increased performance in all browsers and devices - especially on mobile devices.

Well, I do it, but then when I click, nothing else happens.

What am I missing?

+4
source share
1

Velocity CSS- , scrollTop, , CSS-.

velocity CSS (, ..). animate -CSS.

( A.Wolff):

Velocity scrollTop, scroll, :

$element.velocity("scroll", { duration: 1500, easing: "spring" })

@A. Wolff https://github.com/julianshapiro/velocity/issues/26

: Velocity scrollTop, $.animate(). ( - jQuery .)

, , scrollTop animate, , jQuery. , scroll velocity.

P.S. , , .

+2

Source: https://habr.com/ru/post/1625330/


All Articles