Skip to content

Instantly share code, notes, and snippets.

@john45traver
Created May 17, 2014 02:43
Show Gist options
  • Save john45traver/8ac635fb516a1073ead9 to your computer and use it in GitHub Desktop.
Save john45traver/8ac635fb516a1073ead9 to your computer and use it in GitHub Desktop.
Container on scroll
var Engine = require("famous/core/Engine");
var Surface = require("famous/core/Surface");
var Scrollview = require("famous/views/Scrollview");
var ContainerSurface = require('famous/surfaces/ContainerSurface');
var mainContext = Engine.createContext();
var scrollview = new Scrollview();
scrollview.state = new StateModifier({
size:[500,500],
origin: [0.5,1]
});
var surfaces = [];
scrollview.sequenceFrom(surfaces);
for (var i = 0, temp; i < 40; i++) {
temp = new Surface({
content: "Surface: " + (i + 1),
size: [500, 200],
properties: {
backgroundColor: "hsl(" + (i * 360 / 40) + ", 100%, 50%)",
lineHeight: "200px",
textAlign: "center"
}
});
temp.pipe(scrollview);
surfaces.push(temp);
}
container = new ContainerSurface({
size:[500,500],
properties:{
overflow:'hidden'
}
})
container.add(scrollview)
mainContext.add(scrollview.state).add(container);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment