Home › Forums › JavaScript › Parallax count up scrolling › Re: Parallax count up scrolling
December 12, 2012 at 8:27 am
#116973
tommaitland
Member
To me the easiest way would be to get the scroll value and put it through an algorithm to display that text, then write the text on window scroll. As it scrolls down the text can increment up until a max of 57% or however much. Something like:
$(window).scroll( function() {
var waypointPosition = 500;
var scroll = $.scrollTop();
scroll = scroll – waypointPosition;
if (scroll > 57) { scroll = 57; }
$(‘#percentage’).text(‘%’ + scroll);
});
I haven’t tested it so that might not work – but could give you some ideas.