U
U
uoziod2013-04-18 18:05:14
JavaScript
uoziod, 2013-04-18 18:05:14

Safari: AJAX request + DOM manipulation + scrolling at the same time not possible?

Hello Habr.
I'm struggling with one interesting lag that only takes place in Safari.
What I have: initially there are 3 blocks on the page. When we scroll down the page and the screen center reaches the top border of the last block, an AJAX request occurs, after which the top block is deleted, append a new block after the last one and immediately add the height of the removed block to scrollTop. Similar behavior occurs when scrolling up. When the middle of the screen crosses the lower border of the upper block, an AJAX request occurs, after which the lower block is deleted, a new block is inserted before the first one, and the height of the inserted block is subtracted from scrollTop to ensure that we didn’t insert anything anywhere.
You can play here(source code is readable)
So in Chrome, Firefox everything works just fine - as expected.
But in Safari, if you look closely, it seems that very often scrollTop occurs after a certain number of milliseconds ...
In this video, pay attention to these moments: 0:11, 0:26, 0:50, 0:53, 1:00, 1:05.
I tried to do a lot: change the order of events, make all sorts of timeouts - nothing helps ...
Comrades, what are your thoughts on this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Gusakov, 2013-04-18
@hell0w0rd

There is nothing charming about chrome.
Version 27.0.1453.47 beta
OS X 10.7.5
If you scroll quickly - at the end of the page there is an effect of pulling the screen, and continuing to scroll - the color changes, but nothing scrolls

U
uoziod, 2013-05-08
@uoziod

Gentlemen, maybe someone has free Member Center Technical Support (TSIs) applications to find out about the described problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question