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. :)
Merge pull request #4792 from iamalexkempton/patch-1

Change 'document' to 'window' in code example