javascript - how best to create a single scrollable view in famo.us? -


famo.us has "scrollview" scrolls if have multiple surfaces inside it.

i single long page of text, doesn't respond scrolling. given famo.us deliberately overrides normal native scrolling views ( https://github.com/famous/views/issues/45 ), best method famous scroll long page of content?

i'm considering breaking content html apart (eg div div), , adding bunch of surfaces normal scrollview. may work simple content complex non-trivial - js have parse dom of to-be-displayed html.

i thought maybe iframe setup have own scrollbar, haven't got work yet. mean somehow overriding famous' css hiding clipping. fact touchmove events swallowed famous require lot of other workarounds, or forking famous.

i assume using true-sized surface dynamic length long form content. when doing so, scrollview can't understand size of true, no scrolling. can instead wrap our surface in rendernode , modifier , use sizefrom function of modifier wrap true sized surface actual size in pixels. way scrollview knows how long content , scroll accordingly.

here example! hope helps!

var engine = require('famous/core/engine'); var surface = require('famous/core/surface'); var rendernode = require('famous/core/rendernode'); var modifier = require('famous/core/modifier'); var scrollview  = require('famous/views/scrollview');  var context = engine.createcontext();  var content = "lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod \                 tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, \                 quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo \                 consequat. duis aute irure dolor in reprehenderit in voluptate velit esse \                 cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non \                 proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";  var scrollview = new scrollview();  var surfaces = []; scrollview.sequencefrom(surfaces);  surface = new surface({     size:[undefined,true],     content: content,     properties:{         fontsize:'100px'     } })  surface.pipe(scrollview);  surface.node = new rendernode(); surface.mod = new modifier();  surface.mod.sizefrom(function(){     target = surface._currtarget;     if (target){         return [undefined,target.offsetheight];     } else {         return [undefined,true];     } })  surface.node.add(surface.mod).add(surface);  surfaces.push(surface.node);  context.add(scrollview); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -