Skip to content

24 ways to impress your friends

Vote up?

Scott Jehl

ABDELAZIZ: sure thing! Looks alright to me, assuming you’re okay with the 1px scroll in non-Android browsers. Good catch with the orientationchange addition – not a bad idea since it’s concise. One thing that caught my eye: window.pageYOffset will be undefined in some older browsers, like IE8 and older, pre-mango Windows Phone 7, and maybe others. In those cases, I think your check will return a false negative for scroll distance, and jump an already-scrolling user back to top.

Not sure if those browsers are on your radar, but worth thinking about. Thanks!