How do you calculate? Detecting the offset in JS?

//