Yes, you are right! Need to add an extra condition, like this: 
```var scrollContainer = ( opts.scrollContainer[0] === window ) ? $('html, body') : opts.scrollContainer;```