created() {
let options = {
root: null,
rootMargin: "0px",
threshold: [0, 0.8],
};
this.intersectionObserver = new window.IntersectionObserver((entries) => {
entries.forEach((entry) => {
if (entry.target === this.computerObserveTarget) {
if (entry.isIntersecting && entry.intersectionRatio > 0.7) {
this.computerImage.classList.add("settled");
} else if (!entry.isIntersecting && entry.intersectionRatio < 0.2) {
this.computerImage.classList.remove("settled");
}
} else if (entry.target === this.bgCon2) {
if (entry.isIntersecting && entry.intersectionRatio > 0.7) {
this.samJZ.classList.add("settled");
} else if (!entry.isIntersecting && entry.intersectionRatio <= 0.2) {
this.samJZ.classList.remove("settled");
}
}
});
}, options);
},
<div class="bg-con-2" v-element-init="initBgCon2"></div>
initBgCon2(element) {
this.bgCon2 = element;
this.intersectionObserver.observe(this.bgCon2);
}
,