Famo.us ScrollContainer不滚动

时间:2015-05-12 10:51:23

标签: javascript famo.us

define(function(require, exports, module){
var View            = require('src/core/View');
var Surface         = require('src/core/Surface');
var ScrollContainer = require('src/views/ScrollContainer');

function ListView(){
    View.apply(this, arguments);
    _createContent.call(this);
}

ListView.prototype = Object.create(View.prototype);
ListView.prototype.constructor = ListView;
ListView.DEFAULT_OPTIONS = {
    data: []
}

function _createContent(){

    var sc = new ScrollContainer();
    var sequence = [];

    sc.sequenceFrom(sequence);

    for (var i = 0; i < this.options.data.length; i++) {
        var surface = new Surface({
            content: this.options.data[i].name,
            size: [undefined, 40],
            properties: {
                borderBottom: '1px solid #000',
                padding: '10px 15px'
            }
        });
        sequence.push(surface);
    };

    this.add(sc);
}

module.exports = ListView;
});

当你从标题中读到时,我的问题是Famo.us ScrollContainer不滚动。上面的代码用于添加可滚动列表。然后将该模块包含在PageView中。 PageView包含在MainView中,它有一个RenderController来显示或隐藏页面。该列表与传递给该模块的数据一起显示。唯一的问题是滚动。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

$(document).ready(function(){ $('#mainbox').load('divone.html #divet'); }); 需要将事件传递给surface

ScrollContainer