I'm using this javascript function to scroll down webpages by code:
window.scrollBy({ top: 300, behavior: "smooth" });"
This code works fine with my browser on many webpages.
Now I'm on web.whatsapp.com, and the function doesn't do anything.
I can scroll using the arrow keys on the keyboard and by using the mouse wheel, but not using this code.
What could I investigate what goes wrong here?
Thank you.
答案 0 :(得分:1)
By the time of this writing, web.whatsapp.com does not have a scrollable window.
However, the scrollBy
function can also be used to scroll other containers.
Try this to scroll the chat list:
document.getElementById('pane-side').scrollBy({top: 100})
The current obfuscated class for the container wrapping a chat's messages is _2nmDZ
:
document.querySelector('._2nmDZ').scrollBy({top: 100})
Note that both the side panel ID and the chat panel class most certainly will change in the future.