Add scroll option
This commit is contained in:
parent
5ddd2896a1
commit
3ff93e4d1f
|
|
@ -75,12 +75,10 @@
|
|||
socket.addEventListener("message", (event) => {
|
||||
var data = JSON.parse(event.data);
|
||||
Object.entries(data).forEach(([k,v]) => {
|
||||
console.log(k,v);
|
||||
switch (k) {
|
||||
case "scroll":
|
||||
var height = window.innerHeight
|
||||
|| document.documentElement.clientHeight
|
||||
|| document.body.clientHeight;
|
||||
var height = window.scrollHeight
|
||||
|| document.body.scrollHeight;
|
||||
|
||||
window.scrollTo({left : 0, top: height * v, behavior: 'smooth'});
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user