$("#content").scroll(function(e){
var distance_from_top = $("#content").scrollTop();
var theinverse = -1 * distance_from_top;
var theinverse2 = theinverse + "px";
$("#topheader").css( "marginTop", theinverse2);
});
What’s the most efficient way to do the above? Basically make #topheader top margin equal to the negative distance scrolled from the top.
caching caching caching.