The calculation of the summed heights of the elements themselves has finished and by requesting the translateY value of the .scroll element, I can find out which element is in the visible part of the scroll.
He invents the wheel, but works.
When I load elements, I call ScrollManager.setItemHeights(heights) ( heights is an array of element heights in pixels) and to get the index of the current visible element: ScrollManager.getVisibleItemIndex()
angular.module("services") .service('ScrollManager', function() { var getTranslateY, getVisibleItemIndex, setItemHeights, summedHeights; summedHeights = null; setItemHeights = function(heights) { var height, sum, _i, _len; summedHeights = [0]; sum = 0; for (_i = 0, _len = heights.length; _i < _len; _i++) { height = heights[_i]; sum += height; summedHeights.push(sum); } };
Yossi shasho
source share