mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-19 11:09:03 +00:00
Added smooth scrolling option
This commit is contained in:
parent
230688951c
commit
70e6dcf249
@ -16,6 +16,14 @@ module.exports = {
|
||||
desc: "add a scroll to top button.",
|
||||
version: "1.0.0",
|
||||
author: "CloudHill",
|
||||
options: [
|
||||
{
|
||||
key: "smooth",
|
||||
label: "smooth scrolling",
|
||||
type: "toggle",
|
||||
value: true,
|
||||
},
|
||||
],
|
||||
hacks: {
|
||||
"renderer/preload.js"(store, __exports) {
|
||||
document.addEventListener("readystatechange", (event) => {
|
||||
@ -39,7 +47,11 @@ module.exports = {
|
||||
scroll.addEventListener('click', () => {
|
||||
document
|
||||
.querySelector('.notion-frame > .notion-scroller')
|
||||
.scrollTop = 0;
|
||||
.scroll({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: store().smooth ? 'smooth' : 'auto',
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user