encoding-group / paraport

Minimalist and butter smooth parallax scrolling effect relative to the browsers viewport.
https://encoding-group.github.io/paraport/
4 stars 0 forks source link

Avoid "Jump" when scrolling for the first time #5

Open moritzebeling opened 4 years ago

moritzebeling commented 4 years ago

After page load, the parallax offset is calculated. But when you first start scrolling, parallax elements do a jump and then continue to move smoothly.

This means, that the first initial parallax position must be incorrect.

moritzebeling commented 4 years ago

As a first hack, I caused a redraw immediately after setting up all elements:

setTimeout(() => {
  context.onScroll();
}, 1);