Snap.js icon indicating copy to clipboard operation
Snap.js copied to clipboard

Scrolling causes whole page to repaint

Open frjoha opened this issue 11 years ago • 18 comments

We're experiencing performance issues when you are scrolling the main content area. This is most apparent on some android devices like HTC One X, Samsung Galaxy Tab 2 and some other ones we've tested.

The problem is that the main container is positioned absolutely and have overflow:auto so that element handles the scrolling of the content/page. That causes a repaint of whole page when scrolling. If we turn this off the problem disappears but the menu handling also stops working properly.

Is this something that you've given som thought and solved in some one with a fix or workaround? As it is now we can't use snap.js due to performance issues

frjoha avatar Sep 11 '13 13:09 frjoha

@frjoha Incredible find. The next version of Snap.js will be focused solely on performance, and this is a great find. There are also additional things throughout the issues list that point to performance issues, so I will create a new issue soon and reference all of the main performance issues. Thanks!

jakiestfu avatar Sep 11 '13 16:09 jakiestfu

Is the reason that you lose the smooth scroll in iOS? When scrolling you can't 'flick' the page up as you normally can, it stops as soon as you lift off.

I'll open a new issue if you don't think it's related.

Thanks

robhadfield avatar Sep 17 '13 15:09 robhadfield

@Rob-Che Could be, repainting is a pretty heavy process. I mostly noticed the problem on slower android devices but it's a heavy process for all devices and platforms. Some can handle it, some can't

frjoha avatar Sep 18 '13 07:09 frjoha

It's the inertia scroll that seems to stick rather than roll after you release your finger.

The site I'm developing is thankfully not that long so it isn't a major issue. It's such a great script though, thanks @jakiestfu - I hope I can contribute in the future.

robhadfield avatar Sep 18 '13 10:09 robhadfield

Here's a link to my dev site if you want to give it a go : http://jb.robhadfield.co.uk/blog/

robhadfield avatar Sep 18 '13 10:09 robhadfield

Is there a solution already for this problem @jakiestfu?

mvhecke avatar Oct 13 '13 12:10 mvhecke

Aiming for a resolve on the V2 Roadmap @Gamemaniak

robhadfield avatar Oct 13 '13 15:10 robhadfield

I guess the problem is that translate3d is used for the entire page, what do you think that might cause this @Rob-Che?

mvhecke avatar Oct 13 '13 16:10 mvhecke

@Rob-Che Just checking - have you added https://github.com/jakiestfu/Snap.js#independent-scrolling to your CSS and applied the class "scrollable" to your content DIV?

I was experiencing the same problem as you, but this fixed the problem.

jonleverrier avatar Oct 15 '13 09:10 jonleverrier

hm, I'll check that @jonleverrier - not been working on it for a while. I'll report back.

robhadfield avatar Oct 15 '13 09:10 robhadfield

@Rob-Che After adding the CSS to your stylesheet, the example markup would look something like this:

<div id="content" class="snap-content scrollable">

jonleverrier avatar Oct 15 '13 09:10 jonleverrier

I forgot adding the class scrollable and although scrolling seems to go a bit smoother, it doesn't solve the entire page repaint problem.

mvhecke avatar Oct 15 '13 16:10 mvhecke

watch this https://www.youtube.com/watch?v=z0_jD8nO5Zw

ashishsajwan avatar Feb 17 '15 11:02 ashishsajwan

@ashishsajwan Thanks for the tip, but I already created something that better suits my needs.

mvhecke avatar Feb 17 '15 12:02 mvhecke

can you plz share your solution... @Gamemaniak

ashishsajwan avatar Feb 17 '15 12:02 ashishsajwan

@ashishsajwan It's AngularJS based, so I'm not sure if you can do something with it.

mvhecke avatar Feb 17 '15 12:02 mvhecke

@Gamemaniak are you saying that you have moved on to something (based on AngularJS) which gives you similar functionality as snapjs

and you are not using snapjs any more..

ashishsajwan avatar Feb 18 '15 10:02 ashishsajwan

@ashishsajwan Yes, you are right.

mvhecke avatar Feb 18 '15 21:02 mvhecke