I'm making a system where a user scrolling and their score increases. There is a counter which I would like to increase the value of using jQuery (so that the page does not need to refresh) when the scrolling.
How would I go about this?
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery(window).scroll(function(){
if(jQuery(this).scrollTop() > 2000) {
// ......
}
});
});
</script>
It should increase by every 2000px.