Oops, fix magnifier position bug when page is scrolled
This commit is contained in:
parent
347419aee8
commit
30d42d29c1
1 changed files with 2 additions and 2 deletions
|
@ -14,8 +14,8 @@ class MagicMagnifier extends HTMLElement {
|
||||||
#onMouseMove(e) {
|
#onMouseMove(e) {
|
||||||
const lens = this.querySelector("magic-magnifier-lens");
|
const lens = this.querySelector("magic-magnifier-lens");
|
||||||
const rect = this.getBoundingClientRect();
|
const rect = this.getBoundingClientRect();
|
||||||
const x = e.pageX - rect.left;
|
const x = e.clientX - rect.left;
|
||||||
const y = e.pageY - rect.top;
|
const y = e.clientY - rect.top;
|
||||||
this.style.setProperty("--magic-magnifier-x", x + "px");
|
this.style.setProperty("--magic-magnifier-x", x + "px");
|
||||||
this.style.setProperty("--magic-magnifier-y", y + "px");
|
this.style.setProperty("--magic-magnifier-y", y + "px");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue