crittermike / toogles

A fresher, less annoying interface to YouTube.
http://toogl.es
MIT License
418 stars 56 forks source link

Fix whenScrolled directive for non-webkit browsers #9

Closed ispedals closed 11 years ago

ispedals commented 11 years ago

Webkit and non-Webkit engines disagree about whether the body or the documentElement scrolls. Webkit thinks the body scrolls, defining body.scrollTop and setting documentElement.scrollTop to 0. Non-Webkit browsers in standards mode think the opposite and define documentElement.scrollTop while setting body.scrollTop to 0. Sidestep this issue by using window.pageYOffset. pageYOffset is undefined in IE < 9, but those versions are not supported anyway.