added prevScrollY calc for more accurate action behavior