Skip to content

Commit

Permalink
Fix #1639: Edge doesn't implement HTMLElement.prototype.scrollTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent FAYOLLE committed Dec 20, 2018
1 parent 35035df commit b44751d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/browser-sync-client/lib/effects/set-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,14 @@ export function setScrollEffect(
}

function scrollElement(element, scrollProportionally, event: IncomingPayload) {
if (scrollProportionally && element.scrollTo) {
return element.scrollTo(
0,
element.scrollHeight * event.position.proportional
); // % of y axis of scroll to px
if (element.scrollTo) {
if (scrollProportionally) {
element.scrollTo(
0,
element.scrollHeight * event.position.proportional
); // % of y axis of scroll to px
} else {
element.scrollTo(0, event.position.raw.y);
}
}
return element.scrollTo(0, event.position.raw.y);
}

0 comments on commit b44751d

Please sign in to comment.