diff --git a/src/components/project/PdfViewer.vue b/src/components/project/PdfViewer.vue index 0fd8f77..4acd480 100644 --- a/src/components/project/PdfViewer.vue +++ b/src/components/project/PdfViewer.vue @@ -50,43 +50,38 @@ const currentPageIndex = ref(1); // Functions const onPdfLoaded = () => { - const wrapper = document.querySelector('.vpv-pages-inner-container'); - - const observer = new IntersectionObserver( - (entries) => { - entries.forEach((entry, index) => { - if (entry.intersectionRatio > 0.5) { - currentPageIndex.value = parseInt( - entry.target.getAttribute('aria-label').split(' ')[1] - ); - } - }); - }, - { - root: wrapper, - threshold: [0.5], - } - ); - - const observePages = () => { - const pages = document.querySelectorAll('.vpv-page-inner-container'); - pages.forEach((page) => { - if (!page.__observed__) { - observer.observe(page); - page.__observed__ = true; - } - }); - }; - - const mutationObserver = new MutationObserver(() => { - observePages(); - }); - - if (wrapper) { - mutationObserver.observe(wrapper, { childList: true, subtree: true }); - } - - observePages(); + // const wrapper = document.querySelector('.vpv-pages-inner-container'); + // const observer = new IntersectionObserver( + // (entries) => { + // entries.forEach((entry, index) => { + // if (entry.intersectionRatio > 0.5) { + // currentPageIndex.value = parseInt( + // entry.target.getAttribute('aria-label').split(' ')[1] + // ); + // } + // }); + // }, + // { + // root: wrapper, + // threshold: [0.5], + // } + // ); + // const observePages = () => { + // const pages = document.querySelectorAll('.vpv-page-inner-container'); + // pages.forEach((page) => { + // if (!page.__observed__) { + // observer.observe(page); + // page.__observed__ = true; + // } + // }); + // }; + // const mutationObserver = new MutationObserver(() => { + // observePages(); + // }); + // if (wrapper) { + // mutationObserver.observe(wrapper, { childList: true, subtree: true }); + // } + // observePages(); };