>My code is functionally identical to the original. Yours is not : If pageYOffset is available you are returning scrolltop rather than pageYOffset.
>
>Thierry gave you the best solution (but ignored your requirement to use more lines :-})
I had the assumption that pageYOffset was a detection mechanism and not capable of returning a value. So, basically, in the chain of priority, if pageYOffset is available, it will be that one, then documentElement.scrollTop and then body.scrollTop.