mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Working on virtual list scroll stuff
This commit is contained in:
10
dist/js/ionic.js
vendored
10
dist/js/ionic.js
vendored
@ -3363,18 +3363,18 @@ window.ionic = {
|
|||||||
console.log('Scrolling', Date.now());
|
console.log('Scrolling', Date.now());
|
||||||
if(this.isVirtual) {
|
if(this.isVirtual) {
|
||||||
var itemHeight = this.itemHeight;
|
var itemHeight = this.itemHeight;
|
||||||
var totalItems = this.el.children.length;
|
var totalItems = this.listEl.children.length;
|
||||||
var scrollHeight = e.target.scrollHeight
|
var scrollHeight = e.target.scrollHeight
|
||||||
var scrollTop = e.scrollTop;
|
var scrollTop = e.scrollTop;
|
||||||
var height = this.el.parentNode.offsetHeight;
|
var height = this.el.parentNode.offsetHeight;
|
||||||
console.log('LIST VIEW SCROLLED', e, itemHeight, scrollHeight, height);
|
console.log('LIST VIEW SCROLLED', e, itemHeight, scrollHeight, height);
|
||||||
|
|
||||||
var itemsPerPage = Math.floor(scrollHeight / itemHeight);
|
var itemsPerPage = Math.floor(height / itemHeight);
|
||||||
var first = parseInt(scrollTop / itemHeight) - totalItems;
|
var first = parseInt(scrollTop / itemHeight);
|
||||||
console.log('FITS', itemsPerPage, 'per page, starting at', first);
|
console.log('FITS', itemsPerPage, 'per page, starting at', first);
|
||||||
|
|
||||||
var nodes = Array.prototype.slice.call(this.el.children, first, itemsPerPage);
|
var nodes = Array.prototype.slice.call(this.listEl.children, first, first + itemsPerPage);
|
||||||
console.log('Showing these nodes:', nodes);
|
console.log('Showing these', nodes.length, 'nodes:', nodes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -396,18 +396,18 @@
|
|||||||
console.log('Scrolling', Date.now());
|
console.log('Scrolling', Date.now());
|
||||||
if(this.isVirtual) {
|
if(this.isVirtual) {
|
||||||
var itemHeight = this.itemHeight;
|
var itemHeight = this.itemHeight;
|
||||||
var totalItems = this.el.children.length;
|
var totalItems = this.listEl.children.length;
|
||||||
var scrollHeight = e.target.scrollHeight
|
var scrollHeight = e.target.scrollHeight
|
||||||
var scrollTop = e.scrollTop;
|
var scrollTop = e.scrollTop;
|
||||||
var height = this.el.parentNode.offsetHeight;
|
var height = this.el.parentNode.offsetHeight;
|
||||||
console.log('LIST VIEW SCROLLED', e, itemHeight, scrollHeight, height);
|
console.log('LIST VIEW SCROLLED', e, itemHeight, scrollHeight, height);
|
||||||
|
|
||||||
var itemsPerPage = Math.floor(scrollHeight / itemHeight);
|
var itemsPerPage = Math.floor(height / itemHeight);
|
||||||
var first = parseInt(scrollTop / itemHeight) - totalItems;
|
var first = parseInt(scrollTop / itemHeight);
|
||||||
console.log('FITS', itemsPerPage, 'per page, starting at', first);
|
console.log('FITS', itemsPerPage, 'per page, starting at', first);
|
||||||
|
|
||||||
var nodes = Array.prototype.slice.call(this.el.children, first, itemsPerPage);
|
var nodes = Array.prototype.slice.call(this.listEl.children, first, first + itemsPerPage);
|
||||||
console.log('Showing these nodes:', nodes);
|
console.log('Showing these', nodes.length, 'nodes:', nodes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1279,6 +1279,7 @@
|
|||||||
var list = document.getElementById('content');
|
var list = document.getElementById('content');
|
||||||
var lv = new ionic.views.ListView({
|
var lv = new ionic.views.ListView({
|
||||||
el: list,
|
el: list,
|
||||||
|
listEl: list.children[0],
|
||||||
isVirtual: true,
|
isVirtual: true,
|
||||||
itemHeight: 50
|
itemHeight: 50
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user