import $ from "jquery"; import { getAttributesFromEvent } from "../functions/getAttributesFromEvent"; export const scrollEvent = (ip: any) => { if (typeof window !== "undefined") { var allElemWithScroll = $("div").filter(function () { return ( // @ts-ignore $(this).css("overflow") === "auto" || // @ts-ignore $(this).css("overflow") === "scroll" ); }); console.log( "all with flex", allElemWithScroll.prevObject.toArray(), typeof allElemWithScroll ); const addEventTo = allElemWithScroll.prevObject.toArray(); addEventTo.forEach((el: any) => { el.addEventListener( "scroll", async (e: any) => { console.log("scroll event triggered"); const attr = await getAttributesFromEvent(e.target, ip, 5); // @ts-ignore console.log("event triggered attr", attr); }, false ); }); } };