Aashish
Aashish

Reputation: 106

Please tell me what is the meaning of the Boolean this expression returning? ( entry.target.classlist.toggle.valueof )

I want to trigger an if statement when the intersectionObserver API toggles a class in the DOM Element. I am just not sure what exactly is the boolean value returned by this expression: - entry.target.classlist.toggle.valueof; or entry.target.classlist.toggle.valueof();

let intersect = new IntersectionObserver ((entries) => {
    entries.forEach((entry) => {
        if (entry.target.classList.toggle("fix", entry.isIntersecting).valueOf) {
            fixHeader();
        }
        else unFixHeader();
    });
}, {
    rootMargin: "-1%",
    threshold: 1
});

Upvotes: 0

Views: 40

Answers (0)

Related Questions