disable observer
This commit is contained in:
parent
cde0eb1943
commit
4223a9d522
1 changed files with 32 additions and 37 deletions
|
|
@ -50,43 +50,38 @@ const currentPageIndex = ref(1);
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
const onPdfLoaded = () => {
|
const onPdfLoaded = () => {
|
||||||
const wrapper = document.querySelector('.vpv-pages-inner-container');
|
// const wrapper = document.querySelector('.vpv-pages-inner-container');
|
||||||
|
// const observer = new IntersectionObserver(
|
||||||
const observer = new IntersectionObserver(
|
// (entries) => {
|
||||||
(entries) => {
|
// entries.forEach((entry, index) => {
|
||||||
entries.forEach((entry, index) => {
|
// if (entry.intersectionRatio > 0.5) {
|
||||||
if (entry.intersectionRatio > 0.5) {
|
// currentPageIndex.value = parseInt(
|
||||||
currentPageIndex.value = parseInt(
|
// entry.target.getAttribute('aria-label').split(' ')[1]
|
||||||
entry.target.getAttribute('aria-label').split(' ')[1]
|
// );
|
||||||
);
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// },
|
||||||
},
|
// {
|
||||||
{
|
// root: wrapper,
|
||||||
root: wrapper,
|
// threshold: [0.5],
|
||||||
threshold: [0.5],
|
// }
|
||||||
}
|
// );
|
||||||
);
|
// const observePages = () => {
|
||||||
|
// const pages = document.querySelectorAll('.vpv-page-inner-container');
|
||||||
const observePages = () => {
|
// pages.forEach((page) => {
|
||||||
const pages = document.querySelectorAll('.vpv-page-inner-container');
|
// if (!page.__observed__) {
|
||||||
pages.forEach((page) => {
|
// observer.observe(page);
|
||||||
if (!page.__observed__) {
|
// page.__observed__ = true;
|
||||||
observer.observe(page);
|
// }
|
||||||
page.__observed__ = true;
|
// });
|
||||||
}
|
// };
|
||||||
});
|
// const mutationObserver = new MutationObserver(() => {
|
||||||
};
|
// observePages();
|
||||||
|
// });
|
||||||
const mutationObserver = new MutationObserver(() => {
|
// if (wrapper) {
|
||||||
observePages();
|
// mutationObserver.observe(wrapper, { childList: true, subtree: true });
|
||||||
});
|
// }
|
||||||
|
// observePages();
|
||||||
if (wrapper) {
|
|
||||||
mutationObserver.observe(wrapper, { childList: true, subtree: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
observePages();
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue