1
I wonder if it is good practice to store values directly in the elements so you don’t need to calculate again. For example:
function scrollfunc(e){
var el = e.currentTarget;
var deltaY = (el.deltaY !== undefined)? (el.deltaY + e.y) : e.y;
el.style.transform = 'translateY(' + deltaY + 'px)';
el.deltaY = deltaY;
}
document.getElementById('#scrollElement').addEventListener(scrollfunc);