tangled
alpha
login
or
join now
ericwood.org
/
photos-site
1
fork
atom
A little app to serve my photography from my personal website
1
fork
atom
overview
issues
pulls
pipelines
smooth scrolling TOC
ericwood.org
3 months ago
8e426679
a7aa9472
0/0
Waiting for spindle ...
+16
-2
2 changed files
expand all
collapse all
unified
split
src
views
blog
show
script.js
style.css
+12
-1
src/views/blog/show/script.js
···
5
5
intersections[el.id] = document.querySelector(`.blog__toc a[href="#${el.id}"]`);
6
6
});
7
7
8
8
+
Object.values(intersections).forEach((el) => {
9
9
+
document.addEventListener("click", (event) => {
10
10
+
event.preventDefault();
11
11
+
const query = event.target.getAttribute("href");
12
12
+
document.querySelector(query).scrollIntoView({
13
13
+
behavior: "smooth",
14
14
+
});
15
15
+
});
16
16
+
});
17
17
+
18
18
+
8
19
9
20
observer = new IntersectionObserver((entries) => {
10
21
entries.forEach((entry) => {
···
13
24
});
14
25
},
15
26
{
16
16
-
rootMargin: "-50% 0px",
27
27
+
rootMargin: "-30% 0px -60% 0px",
17
28
});
18
29
19
30
document.querySelectorAll(".blog__section").forEach((el) => {
+4
-1
src/views/blog/show/style.css
···
60
60
white-space: break-spaces;
61
61
}
62
62
63
63
+
.blog__section {
64
64
+
scroll-margin-top: 20px;
65
65
+
}
66
66
+
63
67
.blog__heading {
64
68
position: relative;
65
65
-
scroll-margin-top: 20px;
66
69
}
67
70
68
71
.blog__heading a {