Created
May 19, 2014 21:06
-
-
Save kof/0713a751d96026283980 to your computer and use it in GitHub Desktop.
famous scrollview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* globals define */ | |
define(function(require, exports, module) { | |
'use strict'; | |
// import dependencies | |
var Engine = require('famous/core/Engine'); | |
var Modifier = require('famous/core/Modifier'); | |
var Transform = require('famous/core/Transform'); | |
var Scrollview = require("famous/views/Scrollview"); | |
var View = require('famous/core/View'); | |
var Surface = require('famous/core/Surface'); | |
var FlexibleLayout = require('famous/views/FlexibleLayout'); | |
var mainContext = Engine.createContext() | |
function App() { | |
View.apply(this, arguments) | |
this.header = new Header() | |
this.content = new Content() | |
this.navigation = new View() | |
this.scrollview = new Scrollview() | |
this.scrollview.pipe(this) | |
this.add(this.scrollview) | |
this.scrollview.sequenceFrom([this.header, this.content]) | |
;['header', 'content'].forEach(function(name) { | |
this[name].pipe(this.scrollview) | |
}, this) | |
} | |
App.prototype = Object.create(View.prototype) | |
function Header() { | |
View.apply(this, arguments) | |
this.surface = new Surface({ | |
content: 'Header', | |
size: [undefined, 200], | |
properties: { | |
backgroundColor: 'red' | |
} | |
}) | |
this.add(this.surface) | |
this.surface.pipe(this) | |
} | |
Header.prototype = Object.create(View.prototype) | |
function Content() { | |
View.apply(this, arguments) | |
this.surface = new Surface({ | |
content: 'Content', | |
properties: { | |
backgroundColor: 'green' | |
} | |
}) | |
this.add(this.surface) | |
this.surface.pipe(this) | |
} | |
Content.prototype = Object.create(View.prototype) | |
mainContext.add(new App()); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment