Add html to conditionalScroll selector for cross-browser support

Based on https://stackoverflow.com/a/5580456/

Also, change viewportX to viewportY, since y is the convention for
vertical.

Change-Id: I7271ac6638d1609580399a773e24b4a43861e0d8
Merge "Add html to conditionalScroll selector for cross-browser support" into frontend-rewrite