don't read the DOM: use maths instead.