in phonegap app finished, dynamically insert elements dom while scrolling. use 'touchmove' , 'scroll' callbacks. problem i'm facing, dom updates after scrolling has finished. after doing research, think cause phonegap doesn't update dom after scrolling has finished.
has of faced problem themselves, , found solution it?
update
the result of tests javascript not updated @ while scrolling. know why is, , way execute javascript , update dom while scrolling. if can think of way update elements when viewport near them, fine. @ moment updates when user stops scrolling, if user doesn't, meets 'empty' page space.
request scroll detection code
this use detect scrolling.
document.addeventlistener("touchmove", callback, false); // works on android, on ios callback called when scrolling stops. multiple times, because stack while scrolling , not being executed. see event being executed during touchmove, when viewport begins moving, callbacks pause until after scrolling ends. document.addeventlistener("scroll", callback, false); // executed once, , when scrolling has stopped; viewport not moving anymore. on android executed time during scrolling, good.
the combination of updating during touchmove, , time when scrolling has stopped sufficient. chance user scrolls fast(after touchmove) meets empty space small. problem touchmove event callback not executed during scrolling.
i recommend taking @ iscroll, can give lot of control on user scrolling.
it can register when user has scrolled point , can execute function load more dom elements, instantly refresh scroll continue user experience updated elements.
Comments
Post a Comment