Question: I'm trying to determine how many pixels down I've scrolled using `window.scrollY`. But this isn't supported in IE8. What is the safe, cross-browser alternative?

Answer: 
If you have a valid reason for not just using a library to handle this kind of base functionality, don't hesitate 'not to re-invent the wheel'.

[Mootools is open source](https://github.com/mootools/mootools-core/blob/master/Source/Element/Element.Dimensions.js), and you can just 'steal' its implementation, relevant snippets:

```
getScroll: function(){
    var win = this.getWindow(), doc = getCompatElement(this);
    return {x: win.pageXOffset || doc.scrollLeft, y: win.pageYOffset || doc.scrollTop};
}

function getCompatElement(element){
    var doc = element.getDocument();
    return (!doc.compatMode || doc.compatMode == 'CSS1Compat') ? doc.html : doc.body;
}

```

These 2 are the core of deciding which compatibility mode your current browser it has, and then whether to use `window.pageYOffset` or `document.body.scrollTop` based on that or even `document.html.scrollTop` for really ancient buggy browsers.
In angular, we use:

```
  var windowEl = angular.element($window);
  scrolldist = windowEl.scrollTop();

```