javascript - Optimizing Jquery animations -


So I'm trying and on a hunt to understand the best ways to optimize Jquery. Sametime (scrollTo: value) function Take this example:

  $ ('# returnToTop'). ('Click', function () {$ ('html, body'). ({ScrollTop: 0}, 'slow');});   

Here you have a div that acts as a "top" button, when clicked, the page scrolls back to the top, now on complex pages, this is very much Till jerky and not easy. I was wondering if any jQuery ninja will tell us what actually animate function does. On the ordinary page, it's nice and smooth.

Now, I think that it probably makes some calculations that runs down the DOM, so when it's complicated, it takes some time and it seems bouncing. So the heart of the matter is:

Any steps we can take, because developers have to provide jQuery with precise parameters, making this calculation easier, so the animation can smooth. Probably the specific values ​​that are important if provided, will provide a significant speed.

Do anyone have any insights?

Thank you.

For jQuery, the amount of "slow" time is (600 mms to be exact) If this is a big page, then it needs to be trough to go to the top of 600 mms.

If you want to make this animation steady at the height of the page, then the duration to T = offsetTop / k aproximatelly k to run pixels per second, where offsettop is something $ (clicked element) .offet (). Top .

jQuery is also some plugins to do it directly in the way.

Comments