Add a beforeScroll function that allows canceling the scroll due to them result of a function