我有ScrollView
和表面元素序列中。 我希望能够在数组出现后立即滚动到最新的元素。Famo.us ScrollView滚动像在聊天
这是一个演示,我希望它像任何聊天应用程序一样滚动......旧的表面超出了场景,新的将始终处于底部。现在的问题是一样的,如下:Famo.us how to make a scrollview be filled from bottom to top (or right to left)?
Famous.loaded(function() {
var Engine = Famous.Core.Engine;
var Surface = Famous.Core.Surface;
var Scrollview = Famous.Views.Scrollview;
var Timer = Famous.Utilities.Timer;
var mainContext = Engine.createContext();
var scrollview = new Scrollview();
var surfaces = [];
var i = 0;
scrollview.sequenceFrom(surfaces);
Timer.setInterval(function() {
var temp = new Surface({
content: "Surface: " + (i + 1),
size: [undefined, 50],
properties: {
backgroundColor: "hsl(" + (i * 360/40) + ", 100%, 50%)",
lineHeight: "50px",
textAlign: "center"
}
});
temp.pipe(scrollview);
surfaces.push(temp);
i++;
// scrollview.goToNextPage();
}, 400);
mainContext.add(scrollview);
});
嘿!感谢您的回复!是的,我正在使用'scrollView.setPosition(20000)'。问题是我如何计算将曲面放置到序列中时的偏移量,它尚未渲染。据我所知,在得到表面的偏移后,我需要做这样的事情:'scrollView.setPosition(surface.offset - scrollview.height)',对吗? :) –
从你的问题,我担心可能没有好的答案。但也许一些更多的信息将有所帮助。当你创建每个表面时,你为'size'数组选项设置了什么? – Dan