JSFiddle - React, Tailwind, and code Playground
by Nadeesh Peiris
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.2.5/mithril.min.js"></script>
CSS
ul {
width: 300px;
height: 300px;
background-color: #AAA;
overflow: scroll;
}
JavaScript
var app = {};
app.controller = function(){
this.list = [];
this.lastNo = 1;
this.add = function(){
for(var i=0; i<50; i++){
this.list.push('item '+this.lastNo++);
}
}
this.add();
}
app.view = function(ctrl){
return m('div', [
m('h1', 'Infinite Scroll'),
m('ul',
'config': app.configListContainer.bind(),
ctrl.list.map(function(item){
return m('li', item)
}))
]);
}
app.configListContainer = function(event){
}
//initialize the application
m.mount(document.body, app);