souporserious
souporserious

Reputation: 2157

Change content depending where scrollbar is currently at?

Is there a way to change for instance a the color of a link depending how far you have scrolled down? I'm guessing this would be accomplished with jQuery?

Upvotes: 0

Views: 67

Answers (1)

user1626664
user1626664

Reputation: 313

You can use the scrollTop property to see how far the page is scrolled down.

jQuery: http://api.jquery.com/scrollTop/

Javascript: https://developer.mozilla.org/en-US/docs/DOM/element.scrollTop

and $("html").scroll(function(){...}); for the scroll event.

$('a').css('color', 'blue') to change color.

Upvotes: 2

Related Questions