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.",
|
desc: "add a scroll to top button.",
|
||||||
version: "1.0.0",
|
version: "1.0.0",
|
||||||
author: "CloudHill",
|
author: "CloudHill",
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
key: "smooth",
|
||||||
|
label: "smooth scrolling",
|
||||||
|
type: "toggle",
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
hacks: {
|
hacks: {
|
||||||
"renderer/preload.js"(store, __exports) {
|
"renderer/preload.js"(store, __exports) {
|
||||||
document.addEventListener("readystatechange", (event) => {
|
document.addEventListener("readystatechange", (event) => {
|
||||||
@ -39,7 +47,11 @@ module.exports = {
|
|||||||
scroll.addEventListener('click', () => {
|
scroll.addEventListener('click', () => {
|
||||||
document
|
document
|
||||||
.querySelector('.notion-frame > .notion-scroller')
|
.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