Skip to content

Commit

Permalink
fix: intersection root margin match top offset (#1)
Browse files Browse the repository at this point in the history
* fix: intersection root margin match top offset

* fix: intersectionObserver will missing match when scroll to fase
  • Loading branch information
zzxming authored Dec 20, 2024
1 parent 5a2b193 commit 40f1cf9
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 188 deletions.
4 changes: 4 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
position: fixed;
transform: none;
}
.gap {
height: 3000px;
}
</style>
</head>
<body>
Expand All @@ -61,6 +64,7 @@
<div id="output2"></div>
</div>
</div>
<div class="gap"></div>

<script src="./index.js"></script>
</body>
Expand Down
35 changes: 14 additions & 21 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,29 @@ for (const [i, btn] of [document.getElementById('btn1'), document.getElementById

for (const q of quill) {
q.setContents([
{ insert: 'header1' },
{ insert: 'header 1' },
{ attributes: { header: 1 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\nheader1.1' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 1.1' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\nheader1.2' },
{ insert: '\n\n\n\n\n\n\n\n\nheader 1.2' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\nheader1.2.1' },
{ attributes: { header: 3 }, insert: '\n' },
{ insert: '\n\n\n\n\n\nheader1.2.2' },
{ attributes: { header: 3 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader2' },
{ insert: '\n\n\n\nheader 1.3' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\n\nheader2.1' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\nheader 2' },
{ attributes: { header: 1 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\nheader 2.1' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\nheader2.1.1' },
{ insert: '\nheader 2.1.1' },
{ attributes: { header: 3 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\nheader2.1.2' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 2.1.2' },
{ attributes: { header: 3 }, insert: '\n' },
{ insert: '\n\nheader2.1.2.1' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 44444444' },
{ attributes: { header: 4 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 44444444' },
{ attributes: { header: 4 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\nheader2.1.2.1.1' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 5' },
{ attributes: { header: 5 }, insert: '\n' },
{ insert: '\n\nheader2.1.2.1.1.1' },
{ insert: '\n\n\n\n\n\n\n\n\n\nheader 6' },
{ attributes: { header: 6 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\nheader3' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\n\n\nheader3.1' },
{ attributes: { header: 3 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nheader4' },
{ attributes: { header: 2 }, insert: '\n' },
{ insert: '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' },
]);
}
Loading

0 comments on commit 40f1cf9

Please sign in to comment.