Posts tagged 〝comparisons〞

Shortening JavaScripts with Math

June 28th, 2007 at 6:48 pm

Replace clunky if statements with Math.min() and Math.max() to keep a cursor-centred element inside the viewport, and to normalise scrollTop in IE.