Change 'document' to 'window' in code example

The current code example of binding a resize event to `document` does not actually work. Binding the  event to `window` does. :)