add onElementOutOfView

This commit is contained in:
Tom
2023-06-02 13:50:58 +02:00
parent 19a3286ae0
commit 98f000b173
3 changed files with 65 additions and 26 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
function handleQuoteHover(reply, parentCid) {
function handleQuoteHover(reply, parentCid, onElementOutOfView) {
const cid = parentCid ? parentCid : reply.shortCid;
const isMobile = window.innerWidth <= 480;
const postNumberSelector = isMobile ? '.post-number-mobile' : '.post-number-desktop';
@@ -23,6 +23,7 @@ function handleQuoteHover(reply, parentCid) {
};
if (isInViewport(targetElement)) {
onElementOutOfView(cid);
const highlightedElements = document.querySelectorAll('.highlighted');
highlightedElements.forEach(el => {