V
V
Vitaly Komlev2011-11-23 17:18:02
JavaScript
Vitaly Komlev, 2011-11-23 17:18:02

Smooth animation in Javascript?

While working on my site, I ran into an unexpected problem: the browser implements the block movement animation unevenly, in jerks. Chrome, for example, gives a delay, after which it almost instantly moves the block to the desired position. Other browsers move the text so that it ripples and it is impossible to look at the screen.

Do you have any tips for optimizing the source code, maybe fine tuning jQuery? Perhaps you should abandon the framework if it "slows down" the work?

UPD : updated the site, an example of work is not available

Answer the question

In order to leave comments, you need to log in

8 answer(s)
A
Anatoly, 2011-11-23
@vitalikk

Can you create many animations at the same time? If yes, then they should be combined into one handler

V
Vitaly Zheltyakov, 2011-11-23
@VitaZheltyakov

It all depends on the object being moved. If an object calls a lot of recalculations to show the movement, then the animation will slow down.
There are two ways out:
- Use objects in the animation as easy as possible.
- Refuse it some slowdown animations.

T
theaspin, 2011-11-23
@theaspin

By the way, there are brakes due to loading pictures. If the slide appears for the first time, then there is a slight jerk. After loading, the animation becomes smoother.

O
Oleg Yakovenko, 2011-11-23
@Apx

It is unlikely that jquery slows down ... Maybe you have a problem?
Review these examples. Everything is smooth for me. If you don't, then it's something else
anton.shevchuk.name/wp-demo/jquery-tutorials/

S
sdevalex, 2011-11-23
@sdevalex

Ripples are possible if your animation step is too slow (short animation over a long time interval).

F
flight, 2011-11-23
@flight

The problem is with easing enabled. It does not work equally well in all browsers. With the plugin turned off, the result will be completely identical.

F
Finom, 2011-11-24
@Finom

At one time, to optimize animations, I used the following crutch: if the browser supports CSS3 animation, then it is used, if not, then the usual one. If you google, you can find a plugin that modifies jQuery animate by adding CSS3.

D
Dmitry Dedukhin, 2011-11-25
@Demetros

Have you tried animating with scrollLeft?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question