Michiel
Michiel

Reputation: 8103

Change variable depending on how much you scroll

I would like to make a JS page with a variable $depth. And this variable should be constantly adjusted, depending on how much pixels you've scrolled down to the pag.

But I have not a single clue how to write this. Is there anyone with some experience concerning this situation, or any clues how to tackle this issue?

Upvotes: 0

Views: 793

Answers (1)

Larsenal
Larsenal

Reputation: 51176

Easy to do with JQuery:

$(window).scroll(function(e) {
    var position = $(this).scrollTop();
}

Upvotes: 1

Related Questions