How to change position of the element on scroll?

_ChoaSG30_

New Member
I want to change the value of the property \[code\]top\[/code\] at the same time I scroll.I don't want to use \[code\]position: fixed\[/code\]. I use \[code\]position: absolute\[/code\].I would like to add \[code\]1px\[/code\] to the \[code\]box\[/code\] every time I scroll down.I would like to remove \[code\]1px\[/code\] to the \[code\]box\[/code\] every time I scroll up.How to do that ? \[code\]<div id="box" style="position: absolute"> // content</div>$(document).bind('scroll', function(){ $("#box").css("top", ..... ); });\[/code\]
 
Back
Top