I have a <div>
on my website, whose CSS attributes I want to change whenever I have scrolled down 10px of the website. How can I do that?
Asked
Active
Viewed 73 times
0

Ry-
- 218,210
- 55
- 464
- 476

Nabil Ghulam
- 201
- 1
- 3
- 12
-
1http://stackoverflow.com/a/15800696/1947286 this should steer you in the right direction – apaul Jun 23 '13 at 02:25
1 Answers
1
what about something like this:
$(document).ready(function() {
$(window).scroll(function() {
var elementTop = $('.someDiv').offset().top;
var position = elementTop- $(window).scrollTop();
if(position == 10){
//do something
}
});
});
I think this may work, i havent tested it yet but give it try..
Also this jquery function should be really helpful, you also check it out: http://api.jquery.com/position/

Jorge Y. C. Rodriguez
- 3,394
- 5
- 38
- 61