Fix scrolling

The logic for choosing the visible preview pane wasn't always working.
Merge pull request #1 from russelldavis/fix-scrolling

Fix element detection