"fnScrollToRow": function (iRow, bAnimate) {
var px = this.fnRowToPixels(iRow);
this.fnScrollToOffset(px, bAnimate);
},
"fnScrollToOffset": function (px, bAnimate) {
if (typeof bAnimate == 'undefined' || bAnimate) {
$(this.dom.scroller).animate({
"scrollTop": px
});
}
else {
$(this.dom.scroller).scrollTop(px);
}
},
// add an ID to the scroll body so we can pass that to iScroll
var scrollBody = $('div#shoppingCartItemsViewContainer div.dataTables_scrollBody');
scrollBody.attr('id', 'tableContainer');
// calculate a bottom offset to tell iScroll about
var scrollBodyHeight = scrollBody.height();
var tableHeight = (self.getTableElement()).height();
var offsetBottom = tableHeight - scrollBodyHeight;
_debug('debug', 'scroller height = ' + scrollBodyHeight + ', tableHeight = ' + tableHeight + ', calculated offset = ' + offsetBottom);
// wire up an onScrollEnd Event handler for iScroll
var scrollEnd = function () {
var iX = this.x;
var iY = this.y;
_debug('info', 'iScroll.onScrollEnd - iScroll coords = [' + iX + ',' + iY + ']');
// get the scroller control's top position
var scroller = _dataTable.oScroller;
var top = scroller.dom.scroller.scrollTop;
_debug('info', 'oScroller top = [' + top + ']');
// add the iScroll y-offset to it (it's negative, so subtract)
var newTop = top - Math.round(iY);
_debug('info', 'oScroller NEW top = [' + newTop + ']');
// scroll the scroller to the new position and fire the scroll update method
_dataTable.oScroller.fnScrollToOffset(newTop, false);
_dataTable.oScroller._fnScroll();
_debug('info', 'resetting iScroll position to 0,0');
this._pos(0, 0);
};
// init the iScroll
new iScroll('tableContainer', { hScroll: false, offsetBottom: offsetBottom, onScrollEnd: scrollEnd });
tommck said: one problem with 2 finger dragging, it doesn't have acceleration and momentum support, which is a big deal when you've got a large list to get through.
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.