javascript - Scrolling through "touchmove" is choppy -


i wanted "position:fixed" on mobile devices (i have android one) - , doesn't exist.
faked creating 2 divs heights of summed height of screen (using js) , added touch listeners bottom div. events adjust scrolltop value. copy of old "touchscroll.js".

the scrolling works successfully, added sling feel. however, entire scroll choppy compared when os scrolls view of window.

i've read on random places, , somewhere here add -webkit-backface-visibility:hidden; , -webkit-transform:translate3d(0,0,0); css bits solve chop. tried on div itself, on body, backface part, transform etc... permutations... nothing helped. chop still existed, , tricks stopped keyboard appearing in inputs

i tried create internal div within scrolling one, , instead of adjusting scrolltop value move internal div making position:absolute , adjusting it's top. made no difference.

is there solution beat chop?
example here: http://mobile.phantasyrpg.com/so-example

unfortunately there might not solution this, android browsers known poor rendering performance. different android version/device/browser combinations show different performance , compatibility, matter of fact, example runs quite smooth on android 4.0.4 chrome, not functional on factory browser.

as general rule, try use css transformations, , after other properties (like scrolltop), transformations hardware accelerated. (as it's case in ios mobile safari, , modern android browsers).

i suggest try latest version of touchscroll or iscroll, because both use css transformations, , may contain other optimizations well.

the -webkit-transform:translate3d(0,0,0); setting used enforce hardware acceleration, , should used on element changing/moving (the content div in case). if use new versions of scroll libraries, overwrite -webkit-transform property anyway. -webkit-backface-visibility appropriate if -webkit-transform applied on element, setting hidden may resolve unwanted flickering or may provide performance gain in cases.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -