shakyShane/browser-sync — pull request #31 by hugobessaa (2013-12-17 21:05:18+00:00)
Title: Proportional scroll

In order to make scroll ghostMode better, we need to scroll **proportionally**. By doing this, all screens will be synced correctly. This PR fixes #28.

I tested it with 8 browsers opened in the same time on 5 different devices (Android 3.0 tablet, iPad iOS 7, iPhone iOS 7, iMac with Chrome 31, Firefox 25 and Safari 6.1, Lumia 720 WP8 and a VM with IE 9). Tested it against IE 7 and 8 too. **Worked smoothly**.

The proportional scroll made the experience a lot better and easier. Before that, you had to scroll on the smallest device to see the whole page on every device/browser.

To achieve this, I had to add three new methods to `ghost` object:
- `getScrollPercentage` - returns an `array[x, y]` with the current scroll percentage.
- `getScrollSpace()` - returns an `array[x, y]` with the total space the user can scroll.
- `getScrollTopPercentage()` - returns a `number`. The percentage of scroll on Y axis.

and edited two methods:
- `listeners.scroll()` - send percentage of scroll instead of scrollTop.
- anonymous function of `scroll:update` socket event - now gets scrollSpace and sets the scroll position based on the percentage received.

Unit test of scroll event was also edited to cover the changes. It's failing because of a `#` on the URL, but my master is failing too, so, I think the already error was there.

Please discuss about the implementation. This is my first PR here ;-).