aboutsummaryrefslogtreecommitdiff
path: root/e2e/ambassador/src/content/scrolls.js
blob: 4227cf724e669ae2edc557be7d7923afb7ba6f93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const get = () => {
  let element = document.documentElement;
  return {
    xMax: element.scrollWidth - element.clientWidth,
    yMax: element.scrollHeight - element.clientHeight,
    x: element.scrollLeft,
    y: element.scrollTop,
    frameWidth: element.clientWidth,
    frameHeight: element.clientHeight,
  };
};

const set = (x, y) => {
  let element = document.documentElement;
  element.scrollLeft = x;
  element.scrollTop = y;
  return get();
};

export { get, set };