Fixed element offset calculation when using a custom viewport. Also when using a custom viewport, element must also pass check with window as viewport.
Merge pull request #1 from dgbrown/fix-custom-viewport-offset-calculation

fix / enhance behaviour when using custom viewport